Fix ApiQueryInfo break from use of WatchedItemStore
authoraddshore <addshorewiki@gmail.com>
Tue, 15 Mar 2016 16:08:45 +0000 (16:08 +0000)
committeraddshore <addshorewiki@gmail.com>
Tue, 15 Mar 2016 16:08:45 +0000 (16:08 +0000)
Fixes an issue introduced in:
I5a465773599cce9f8c9e94847cede6d12282c827

The new code now returns all targets even when 0
watcher have been found.
This patch adjusts the api to expect that.

Bug: T129482
Change-Id: Ie84e6feaa42db1bc7a1f89b56aed37dd7fe95ea4

includes/api/ApiQueryInfo.php

index a3c98ed..3aa0122 100644 (file)
@@ -453,10 +453,8 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                if ( $this->fld_watchers ) {
-                       if ( isset( $this->watchers[$ns][$dbkey] ) ) {
+                       if ( $this->watchers[$ns][$dbkey] !== 0 || $this->showZeroWatchers ) {
                                $pageInfo['watchers'] = $this->watchers[$ns][$dbkey];
-                       } elseif ( $this->showZeroWatchers ) {
-                               $pageInfo['watchers'] = 0;
                        }
                }