Page MenuHomePhabricator

Special:Gather/all/recent pagination is broken
Closed, ResolvedPublic

Description

This was fixed:

Go to http://en.m.wikipedia.beta.wmflabs.org/wiki/Special:Gather/all/recent

I've populated the wiki with "active" collections so that we could test the infinite scrolling (which we are going to hit in production for sure)

Scroll to the bottom and you will see that loading collections failed.

This is most probably because https://github.com/wikimedia/mediawiki-extensions-Gather/blob/master/resources/ext.gather.collections.list/CollectionsList.js#L105` there the collection type was renamed to 'recent' and not 'active' as you can see in the code.

Now it is broken if you do the same thing but as an anonymous user.

  1. As an anonymous user, go to http://en.m.wikipedia.beta.wmflabs.org/wiki/Special:Gather/all/recent
  2. Scroll down, pagination is broken.

See comment for what to do:

This is the pagination query being made:
http://en.m.wikipedia.beta.wmflabs.org/w/api.php?action=query&format=json&lstmode=allpublic&lstcontinue=20150623112529%7C451&lstminitems=4&list=lists&lstlimit=50&lsttitle=&lstprop=label%7Cdescription%7Cpublic%7Cimage%7Ccount%7Cowner

And this is what it should be:
http://en.m.wikipedia.beta.wmflabs.org/w/api.php?action=query&format=json&lstmode=allpublic&lstcontinue=20150623112529%7C451&lstminitems=4&list=lists&lstlimit=50&&lstprop=label%7Cdescription%7Cpublic%7Cimage%7Ccount%7Cowner

Note that it's missing lstmode=allpublic (because you need that if you're not logged in instead of always) and it shouldn't have lsttitle= (which does nothing but if present breaks allpublic).

These involve touching:

Herp darmit... this is important to fix on the next release (1.26wmf12 scheduled for 30 of June.

Event Timeline

Jhernandez raised the priority of this task from to High.
Jhernandez updated the task description. (Show Details)
Jhernandez moved this task to To Do on the Reading-Web-Sprint-50-The-X-Files board.

Change 220118 had a related patch set uploaded (by Jhernandez):
Fix api call for recent/active collections

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

Change 220118 merged by jenkins-bot:
Fix api call for recent/active collections

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

I've tried it out in beta cluster and it works now.

Leaving it in signoff to get more eyes on it.

@Jhernandez: I see the API call being made and succeed when I'm logged in. However, when I'm not logged in, I can still browse to /all/recent but the API call fails with the following error:

{
  "servedby": "deployment-mediawiki01",
  "error": {
    "code": "lstnotloggedin",
    "info": "You must be logged-in or use owner and/or ids parameters",
    "*": "See http://en.wikipedia.beta.wmflabs.org/w/api.php for API usage"
  }
}

and a toast pops up with the message "Loading more collections failed".

Jhernandez raised the priority of this task from High to Unbreak Now!.EditedJun 25 2015, 10:12 AM

Crappppp... good catch @phuedx.

This is the pagination query being made:
http://en.m.wikipedia.beta.wmflabs.org/w/api.php?action=query&format=json&lstmode=allpublic&lstcontinue=20150623112529%7C451&lstminitems=4&list=lists&lstlimit=50&lsttitle=&lstprop=label%7Cdescription%7Cpublic%7Cimage%7Ccount%7Cowner

And this is what it should be:
http://en.m.wikipedia.beta.wmflabs.org/w/api.php?action=query&format=json&lstmode=allpublic&lstcontinue=20150623112529%7C451&lstminitems=4&list=lists&lstlimit=50&&lstprop=label%7Cdescription%7Cpublic%7Cimage%7Ccount%7Cowner

Note that it's missing lstmode=allpublic (because you need that if you're not logged in instead of always) and it shouldn't have lsttitle= (which does nothing but if present breaks allpublic).

These involve touching:

Herp darmit... this is important to fix on the next release (1.26wmf12 scheduled for 30 of June), gonna bump priority and set back to TODO.

Go for it @NiharikaKohli - again this is another urgent one so I will review you promptly :-)

Change 220841 had a related patch set uploaded (by Niharika29):
Fix Gather:Special/all/recent pagination

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

@Jdlrobson, I'm having a hard time testing this. No matter how many collections I create, I don't see the load failed toast in my local installation.

@NiharikaKohli: Are you logged out?

@phuedx, Yes. I think I need to create a very large number of collections for the toast to appear. Is that correct?
Can I enter the database and do that faster?

@NiharikaKohli, you can run this script in your browser's console to create collections faster.

Api = mw.mobileFrontend.require(  'ext.gather.api/CollectionsApi' )
api = new Api()
function addTestColl (i) {
  api.postWithToken( 'watch', {
    action: 'editlist',
    perm: 'public',
    label: 'Cats '+i+' test pagination',
    titles: 'Kitten|Cat|Feral cat|Cat behavior'
  } ).then(function (data) {
    console.log( i, data )
    if (i > 0) addTestColl( --i )
  })
}
addTestColl(150)

Original author is @Jhernandez.

@bmansurov, Thanks. I'm getting "Error: Module not found: ext.gather.api/CollectionsApi" in the console even though I can see the script ext.gather.api loading in Resources. Not sure what's up.

@NiharikaKohli, I just ran the script on /wiki/Special:Gather/by/Baha and it worked. Try doing something similar and hopefully you won't see the error.

Change 220841 merged by jenkins-bot:
Fix Gather:Special/all/recent pagination

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

The "View more collections" button looks like it's working as designed. Thanks @NiharikaKohli!

However, when I click the button, I notice that the URL references /all/public rather than /all/recent. Consequently, the new page of collections is loaded with table styles rather, which is jarring.

I think that this is a pre-existing bug with the "Recent" pagination /cc @Jhernandez @Jdlrobson

Created T103974 for fixing that problem @phuedx, we can sign-off this one since the most frequent use cases seem to be working now. We'll track the remaining work on the new task.