jenkins-bot has submitted this change and it was merged.

Change subject: Proper check for label being a watchlist
......................................................................


Proper check for label being a watchlist

Doing if ( !$label ) is incorrect because
watchlists named '0' would be treated as
'falsey', thus becoming watchlists.

Change-Id: Ie2a9a3512e55c6bfd891a1c4ac8fd9f88e621ea0
---
M includes/api/ApiEditList.php
M includes/api/ApiQueryListPages.php
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiEditList.php b/includes/api/ApiEditList.php
index 42c1fdc..19ace09 100644
--- a/includes/api/ApiEditList.php
+++ b/includes/api/ApiEditList.php
@@ -138,7 +138,7 @@
                                $this->updateListDb( $dbw, $params, $row );
                        } else {
                                // Check again - we didn't know it was a 
watchlist until DB query
-                               if ( !$row->gl_label ) {
+                               if ( $row->gl_label === '' ) {
                                        $this->dieUsage( "Watchlist may not be 
deleted", 'badid' );
                                }
                                if ( strval( $row->gl_user ) !== strval( 
$user->getId() ) ) {
diff --git a/includes/api/ApiQueryListPages.php 
b/includes/api/ApiQueryListPages.php
index 98761b3..7ecf1f9 100644
--- a/includes/api/ApiQueryListPages.php
+++ b/includes/api/ApiQueryListPages.php
@@ -108,7 +108,7 @@
                                }
                        }
 
-                       if ( !$listRow->gl_label ) {
+                       if ( $listRow->gl_label === '' ) {
                                // This is actually a watchlist, and it is 
either public or belongs to current user
                                $titles = $this->queryLegacyWatchlist( $params, 
$isGenerator, $listRow->gl_user );
                        } else {

-- 
To view, visit https://gerrit.wikimedia.org/r/197809
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie2a9a3512e55c6bfd891a1c4ac8fd9f88e621ea0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to