Petr Onderka has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/49390


Change subject: Return user ID as userid in watchlist API module
......................................................................

Return user ID as userid in watchlist API module

Currently, the watchlist module returns both user ID
and user name as 'user'. This is not only confusing,
but it also means both can't be returned at the same time.

This change fixes, by returning user ID as 'userid'
and user name as 'user'. For backwards compatibility,
if only user ID is requested, both 'user' and 'userid'
will contain the user ID.

This could be considered a breaking change if both
user ID and user name are requested, but in that case,
the output is currently broken anyway.

Change-Id: I50364659f8fec0136d4ef25ccf137d509df33c41
---
M includes/api/ApiQueryWatchlist.php
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/49390/1

diff --git a/includes/api/ApiQueryWatchlist.php 
b/includes/api/ApiQueryWatchlist.php
index dd50624..53f4230 100644
--- a/includes/api/ApiQueryWatchlist.php
+++ b/includes/api/ApiQueryWatchlist.php
@@ -240,12 +240,14 @@
 
                if ( $this->fld_user || $this->fld_userid ) {
 
-                       if ( $this->fld_user ) {
-                               $vals['user'] = $row->rc_user_text;
+                       if ( $this->fld_userid ) {
+                               $vals['userid'] = $row->rc_user;
+                               // for backwards compatibility
+                               $vals['user'] = $row->rc_user;
                        }
 
-                       if ( $this->fld_userid ) {
-                               $vals['user'] = $row->rc_user;
+                       if ( $this->fld_user ) {
+                               $vals['user'] = $row->rc_user_text;
                        }
 
                        if ( !$row->rc_user ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50364659f8fec0136d4ef25ccf137d509df33c41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Petr Onderka <[email protected]>

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

Reply via email to