From: Roan Kattouw Date: Thu, 3 Jan 2019 01:41:04 +0000 (-0800) Subject: ApiSetNotificationTimestamp: Make entirewatchlist more efficient X-Git-Tag: 1.34.0-rc.0~3061^2 X-Git-Url: https://git.cyclocoop.org/admin/Duna?a=commitdiff_plain;h=ebcac0053eeed3fc28b8f326d111933345061803;p=lhc%2Fweb%2Fwiklou.git ApiSetNotificationTimestamp: Make entirewatchlist more efficient Use WatchedItemStore's built-in feature for clearing the entire watchlist when no timestamp is specified. When a timestamp is specified, this will still use the inefficient page-by-page method, which I'll improve in a follow-up commit. Bug: T207941 Change-Id: I2008ff89c95fe6f66a3fd789d2cef0e8fe52bd93 --- diff --git a/RELEASE-NOTES-1.33 b/RELEASE-NOTES-1.33 index 3dfca9a44e..d73a260997 100644 --- a/RELEASE-NOTES-1.33 +++ b/RELEASE-NOTES-1.33 @@ -80,6 +80,8 @@ production. * (T212356) When using action=delete on pages with many revisions, the module may return a boolean-true 'scheduled' and no 'logid'. This signifies that the deletion will be processed via the job queue. +* action=setnotificationtimestamp will now update the watchlist asynchronously + if entirewatchlist is set, so updates may not be visible immediately === Action API internal changes in 1.33 === * A number of deprecated methods for API documentation, intended for overriding diff --git a/includes/api/ApiSetNotificationTimestamp.php b/includes/api/ApiSetNotificationTimestamp.php index b81c5bf6e0..41c207bd9a 100644 --- a/includes/api/ApiSetNotificationTimestamp.php +++ b/includes/api/ApiSetNotificationTimestamp.php @@ -108,10 +108,14 @@ class ApiSetNotificationTimestamp extends ApiBase { $result = []; if ( $params['entirewatchlist'] ) { // Entire watchlist mode: Just update the thing and return a success indicator - $watchedItemStore->setNotificationTimestampsForUser( - $user, - $timestamp - ); + if ( is_null( $timestamp ) ) { + $watchedItemStore->resetAllNotificationTimestampsForUser( $user ); + } else { + $watchedItemStore->setNotificationTimestampsForUser( + $user, + $timestamp + ); + } $result['notificationtimestamp'] = is_null( $timestamp ) ? ''