Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260329

Change subject: Fix: Duplicates in the manually curated suggestion list
......................................................................

Fix: Duplicates in the manually curated suggestion list

The internal methods in API was not passing the correct seed and offset

Bug: T120804
Change-Id: I65d3f8927b87ddf0d01d3917d8166d4edbb5065a
---
M api/ApiQueryContentTranslationSuggestions.php
M includes/SuggestionListManager.php
M modules/dashboard/ext.cx.suggestionlist.js
3 files changed, 18 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/29/260329/1

diff --git a/api/ApiQueryContentTranslationSuggestions.php 
b/api/ApiQueryContentTranslationSuggestions.php
index 4bbbd2e..9de6ffb 100644
--- a/api/ApiQueryContentTranslationSuggestions.php
+++ b/api/ApiQueryContentTranslationSuggestions.php
@@ -84,7 +84,13 @@
                        );
 
                        // Get non-personalized suggestions
-                       $publicSuggestions = $manager->getPublicSuggestions( 
$from, $to, $params['limit'] );
+                       $publicSuggestions = $manager->getPublicSuggestions(
+                               $from,
+                               $to,
+                               $params['limit'],
+                               $params['offset'],
+                               $params['seed']
+                       );
 
                        // Merge the personal lists to public lists. There 
won't be duplicates
                        // because the list of lists is an associative array 
with listId as a key.
diff --git a/includes/SuggestionListManager.php 
b/includes/SuggestionListManager.php
index 82897e8..105b5b5 100644
--- a/includes/SuggestionListManager.php
+++ b/includes/SuggestionListManager.php
@@ -252,7 +252,7 @@
         * @param int $seed Seed to use with randomizing of results.
         * @return array Lists and suggestions
         */
-       public function getPublicSuggestions( $from, $to, $limit ) {
+       public function getPublicSuggestions( $from, $to, $limit, $offset, 
$seed ) {
                return $this->getSuggestionsByType(
                        array(
                                SuggestionList::TYPE_CATEGORY,
@@ -260,8 +260,10 @@
                        ),
                        $from,
                        $to,
-                       $limit
-                );
+                       $limit,
+                       $offset,
+                       $seed
+               );
        }
 
        /**
diff --git a/modules/dashboard/ext.cx.suggestionlist.js 
b/modules/dashboard/ext.cx.suggestionlist.js
index 090867f..51a4dcd 100644
--- a/modules/dashboard/ext.cx.suggestionlist.js
+++ b/modules/dashboard/ext.cx.suggestionlist.js
@@ -215,6 +215,12 @@
                        return $.Deferred().reject();
                }
 
+               if ( !list.queryContinue ) {
+                       // Along with list information, we had fetch 4 
suggestions as well.
+                       list.queryContinue = {
+                               offset: 4
+                       };
+               }
                params = $.extend( {
                        action: 'query',
                        list: 'contenttranslationsuggestions',

-- 
To view, visit https://gerrit.wikimedia.org/r/260329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65d3f8927b87ddf0d01d3917d8166d4edbb5065a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to