Page MenuHomePhabricator

API: action=setnotificationtimestamp can't set a null timestamp anymore
Closed, ResolvedPublic

Description

Hi, I use this script to add the number of page to watch in to top right corner of my screen.
But today I've always "1000+" as number, whatever I mark all the watchlist as read.
You can check that by mark it as read and go to https://fr.wikipedia.org/wiki/Sp%C3%A9cial:ApiSandbox#action=query&format=json&meta=userinfo&uiprop=unreadcount


It turns out the direct cause of this is rMW9ea1142fad93: Mark pages on watchlist as visited using JS without reload which caused the "mark all pages as visited" button to start using an API call to action=setnotificationtimestamp instead of calling $user->clearAllNotifications();. That should work, but action=setnotificationtimestamp setting an empty timestamp has been broken since rMWeacec0a22345: add setNotificationTimestampsForUser to WatchedItemStore.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 16 2016, 7:08 PM
Anomie added a subscriber: Anomie.Dec 16 2016, 7:25 PM

It turns out the direct cause of this is rMW9ea1142fad93: Mark pages on watchlist as visited using JS without reload which caused the "mark all pages as visited" button to start using an API call to action=setnotificationtimestamp instead of calling $user->clearAllNotifications();. That should work, but action=setnotificationtimestamp setting an empty timestamp has been broken since rMWeacec0a22345: add setNotificationTimestampsForUser to WatchedItemStore.

Anomie renamed this task from API: unreadcount is broken to API: action=setnotificationtimestamp can't set a null timestamp anymore.Dec 16 2016, 7:25 PM
Anomie updated the task description. (Show Details)
This comment was removed by Framawiki.

Change 327785 had a related patch set uploaded (by Anomie):
WatchedItemStore::setNotificationTimestampsForUser(): Allow clearing timestamp

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

Anomie claimed this task.Dec 16 2016, 7:33 PM
Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.

Change 327785 merged by jenkins-bot:
WatchedItemStore::setNotificationTimestampsForUser(): Allow clearing timestamp

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

Anomie closed this task as Resolved.Dec 16 2016, 9:02 PM

Unless someone backports it, this should be deployed to WMF wikis with 1.27.0-wmf.7. Then you'll have to use the "mark all pages as visited" button again to fix the fields.

In the mean time, a workaround would be to use the button with JavaScript disabled so as to avoid the script added in rMW9ea1142fad93: Mark pages on watchlist as visited using JS without reload, or otherwise POST to /wiki/Special:Watchlist?reset=1.

Thank you for your investigation.