From: Brad Jorsch Date: Tue, 3 Jun 2014 19:06:27 +0000 (-0400) Subject: API: Add show=unread to ApiQueryWatchlist X-Git-Tag: 1.31.0-rc.0~15438^2 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=ad0ac845cc5db839c34ac2aef2b2f304cc1d8b69;p=lhc%2Fweb%2Fwiklou.git API: Add show=unread to ApiQueryWatchlist This allows for retrieving only those pages that have changes since the last visit. Bug: 65246 Change-Id: I81d2fae39178708efc0f57e5acea93b50463bc7a --- diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index f0370ca417..a85a3a084a 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -100,6 +100,7 @@ production. * action=expandtemplates has a new parameter, prop, and a new output format. The old format is still used if prop isn't provided, but this is deprecated. * meta=userinfo can now return the count of unread pages on the watchlist. +* list=watchlist can now filter by unread status. === Languages updated in 1.24 === diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 9a4dd82555..837ad28431 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -168,6 +168,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { || ( isset( $show['bot'] ) && isset( $show['!bot'] ) ) || ( isset( $show['anon'] ) && isset( $show['!anon'] ) ) || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) ) + || ( isset( $show['unread'] ) && isset( $show['!unread'] ) ) ) { $this->dieUsageMsg( 'show' ); } @@ -191,6 +192,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addWhereIf( 'rc_user != 0', isset( $show['!anon'] ) ); $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) ); $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) ); + $this->addWhereIf( 'wl_notificationtimestamp IS NOT NULL', isset( $show['unread'] ) ); + $this->addWhereIf( 'wl_notificationtimestamp IS NULL', isset( $show['!unread'] ) ); } if ( !is_null( $params['type'] ) ) { @@ -490,6 +493,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { '!anon', 'patrolled', '!patrolled', + 'unread', + '!unread', ) ), 'type' => array(