Merge "Allow partially blocked users to tag unrelated revisions"
[lhc/web/wiklou.git] / includes / api / ApiSetNotificationTimestamp.php
index b81c5bf..7e9f56d 100644 (file)
@@ -77,8 +77,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
                        $titles = $pageSet->getGoodTitles();
                        $title = reset( $titles );
                        if ( $title ) {
+                               // XXX $title isn't actually used, can we just get rid of the previous six lines?
                                $timestamp = MediaWikiServices::getInstance()->getRevisionStore()
-                                       ->getTimestampFromId( $title, $params['torevid'], IDBAccessObject::READ_LATEST );
+                                       ->getTimestampFromId( $params['torevid'], IDBAccessObject::READ_LATEST );
                                if ( $timestamp ) {
                                        $timestamp = $dbw->timestamp( $timestamp );
                                } else {
@@ -92,7 +93,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                        $titles = $pageSet->getGoodTitles();
                        $title = reset( $titles );
                        if ( $title ) {
-                               $revid = $title->getNextRevisionID( $params['newerthanrevid'], Title::GAID_FOR_UPDATE );
+                               $revid = $title->getNextRevisionID( $params['newerthanrevid'], Title::READ_LATEST );
                                if ( $revid ) {
                                        $timestamp = $dbw->timestamp(
                                                MediaWikiServices::getInstance()->getRevisionStore()->getTimestampFromId( $title, $revid )
@@ -108,10 +109,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                $result = [];
                if ( $params['entirewatchlist'] ) {
                        // Entire watchlist mode: Just update the thing and return a success indicator
-                       $watchedItemStore->setNotificationTimestampsForUser(
-                               $user,
-                               $timestamp
-                       );
+                       $watchedItemStore->resetAllNotificationTimestampsForUser( $user, $timestamp );
 
                        $result['notificationtimestamp'] = is_null( $timestamp )
                                ? ''
@@ -157,7 +155,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
                                        $ns = $title->getNamespace();
                                        $dbkey = $title->getDBkey();
                                        $r = [
-                                               'ns' => intval( $ns ),
+                                               'ns' => (int)$ns,
                                                'title' => $title->getPrefixedText(),
                                        ];
                                        if ( !$title->exists() ) {