Page MenuHomePhabricator

Add handling for expiring watchlist items on Special:GlobalWatchlist
Closed, ResolvedPublic8 Estimated Story PointsFeature

Description

If a watchlist entry shown is watched temporarily, this should be indicated

  • Investigate how core indicates this on Special:Watchlist
  • Investigate feasibility of rendering the same or similar indications for Special:GlobalWatchlist, given the differences in the rendering code
  • Determine which indications should be shown to the user
  • Add those indications
  • Handle unwatch/rewatching

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.
DannyS712 set the point value for this task to 8.
DannyS712 changed the subtype of this task from "Task" to "Feature Request".

Okay, now that this is possible (T263796: Watchlist query api should report time remaining), some investigation
Core entries have a clock icon between the title and the rest of the entry (including diff links) with a tooltip with the expiration
That icon can be created in JavaScript via OO.ui.IconWidget with the clock icon and shown as part of the entries

Icon widget
var icon = new OO.ui.IconWidget( {
	'icon': 'clock',
	'title': 'Tooltip goes here'
} );

The tooltip comes from converting the expiration timestamp into a user-facing string like "7 days left in your watchlist"
Need to implement WatchedItem::calculateExpiryInDays and ::getExpiryInDaysText in JavaScript

Expiration to days remaining
function getDaysRemaining ( expiration ) {
	var expirationDate = new Date( expiration );
	var differenceMs = expirationDate.getTime() - Date.now();
	var days = Math.ceil( differenceMs / 1000 / 86400 ) + 0;
	return days;
}

Use === 0 for a few hours remaining, otherwise use the same core message for days remaining.

Core messages to load
"watchlist-expiring-days-full-text": "{{PLURAL:$1|1 day|$1 days}} left in your watchlist",
"watchlist-expiring-hours-full-text": "A few hours left in your watchlist",
DannyS712 moved this task from Next to In progress on the User-DannyS712 board.
DannyS712 moved this task from Backlog to Later on the MediaWiki-extensions-GlobalWatchlist board.

Change 651706 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/GlobalWatchlist@master] Add handling for expiring watchlist items on Special:GlobalWatchlist

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

Change 651706 merged by jenkins-bot:
[mediawiki/extensions/GlobalWatchlist@master] Add handling for expiring watchlist items on Special:GlobalWatchlist

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

doesn't work for log entries...

Change 656475 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/GlobalWatchlist@master] watchlistUtils: pass on expiry of log entries

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

Change 656475 merged by jenkins-bot:
[mediawiki/extensions/GlobalWatchlist@master] watchlistUtils: pass on expiry of log entries

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

DannyS712 claimed this task.
DannyS712 moved this task from Backlog to Done on the Expiring-Watchlist-Items board.
DannyS712 moved this task from In progress to Done on the MediaWiki-extensions-GlobalWatchlist board.
DannyS712 updated the task description. (Show Details)
DannyS712 set Final Story Points to 10.

Works on the beta cluster now