Phuedx has uploaded a new change for review.

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

Change subject: [WIP] Fix watchlist query continuation and rendering
......................................................................

[WIP] Fix watchlist query continuation and rendering

When the user scrolls to the bottom of the page, an API request is made
with client-generated continuation parameters. The initial value of the
"continue" continuation parameter was incorrectly set to "". Set the
value of the parameter to "gwrcontinue||" as is returned by a
successful API request that isn't complete.

The rendering of watchlist items fetched from the API, i.e. via
WatchListApi#load, was broken in
b82f3d61683eba8e807e0cfb976bbe079fc0e5e9. Update the
WatchListApi#parseData method to return an object that can be rendered
by the PageListItem.hogan template.

Bug: T101453
Change-Id: I1c17f9c2be6b06ecb2e7d2f541d7f15bf960fd3b
---
M resources/mobile.watchlist/WatchListApi.js
1 file changed, 11 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/58/230558/1

diff --git a/resources/mobile.watchlist/WatchListApi.js 
b/resources/mobile.watchlist/WatchListApi.js
index 461b221..b52528a 100644
--- a/resources/mobile.watchlist/WatchListApi.js
+++ b/resources/mobile.watchlist/WatchListApi.js
@@ -22,7 +22,7 @@
 
                        if ( lastTitle ) {
                                this.continueParams = {
-                                       continue: '-||',
+                                       continue: 'gwrcontinue||',
                                        gwrcontinue: '0|' + lastTitle.replace( 
/ /g, '_' )
                                };
                                this.shouldSkipFirstTitle = true;
@@ -49,6 +49,7 @@
                                        prop: 'pageimages|info',
                                        piprop: 'thumbnail',
                                        pithumbsize: mw.config.get( 
'wgMFThumbnailSizes' ).tiny,
+                                       pilimit: this.limit,
                                        format: 'json',
                                        generator: 'watchlistraw',
                                        gwrnamespace: '0',
@@ -61,6 +62,7 @@
                                // then request one extra element (make room 
for that last title) which
                                // will be removed later when parsing data.
                                params.gwrlimit += 1;
+                               params.pilimit += 1;
                        }
                        return this.get( params, {
                                url: this.apiUrl
@@ -107,13 +109,12 @@
                        // Transform the items to a sensible format
                        return $.map( pages, function ( item ) {
                                var delta, msgId, thumb, data,
-                                       pageimageClass = 'list-thumb-none 
list-thumb-x',
                                        listThumbStyleAttribute = '';
 
-                               if ( item.thumbnail ) {
-                                       thumb = item.thumbnail;
-                                       listThumbStyleAttribute = 
'background-image: url(' + thumb.source + ')';
-                                       pageimageClass = thumb.width > 
thumb.height ? 'list-thumb-y' : 'list-thumb-x';
+                               thumb = item.thumbnail;
+
+                               if ( thumb ) {
+                                       thumb.isLandscape = thumb.width > 
thumb.height;
                                }
 
                                // page may or may not exist.
@@ -128,19 +129,18 @@
                                }
 
                                data = {
-                                       heading: item.title,
+                                       displayTitle: item.title,
                                        id: item.pageid,
-                                       listThumbStyleAttribute: 
listThumbStyleAttribute,
-                                       pageimageClass: pageimageClass,
-                                       title: item.title,
                                        url: mw.util.getUrl( item.title ),
-                                       thumbnail: item.thumbnail
+                                       thumbnail: thumb
                                };
+
                                if ( msgId ) {
                                        data.lastModified = mw.msg( 
'mobile-frontend-watchlist-modified',
                                                mw.msg( msgId, delta.value ) );
                                        data.additionalClasses = 'new';
                                }
+
                                return data;
                        } );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c17f9c2be6b06ecb2e7d2f541d7f15bf960fd3b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to