jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/395821 )
Change subject: Add edit tags to list=watchlist
......................................................................
Add edit tags to list=watchlist
It is using the same query as list=recentchanges by left joining
tag_summary
Bug: T181975
Change-Id: I9e9ab9753ec0f813e9e555106cc81fd15ad9fb4a
---
M includes/api/ApiQueryWatchlist.php
M includes/api/i18n/en.json
M includes/api/i18n/qqq.json
M includes/watcheditem/WatchedItemQueryService.php
4 files changed, 29 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Anomie: Looks good to me, approved
diff --git a/includes/api/ApiQueryWatchlist.php
b/includes/api/ApiQueryWatchlist.php
index 1e3b2c7..710550a 100644
--- a/includes/api/ApiQueryWatchlist.php
+++ b/includes/api/ApiQueryWatchlist.php
@@ -53,7 +53,7 @@
$fld_flags = false, $fld_timestamp = false, $fld_user = false,
$fld_comment = false, $fld_parsedcomment = false, $fld_sizes =
false,
$fld_notificationtimestamp = false, $fld_userid = false,
- $fld_loginfo = false;
+ $fld_loginfo = false, $fld_tags;
/**
* @param ApiPageSet $resultPageSet
@@ -82,6 +82,7 @@
$this->fld_patrol = isset( $prop['patrol'] );
$this->fld_notificationtimestamp = isset(
$prop['notificationtimestamp'] );
$this->fld_loginfo = isset( $prop['loginfo'] );
+ $this->fld_tags = isset( $prop['tags'] );
if ( $this->fld_patrol ) {
if ( !$user->useRCPatrol() &&
!$user->useNPPatrol() ) {
@@ -243,6 +244,9 @@
if ( $this->fld_loginfo ) {
$includeFields[] =
WatchedItemQueryService::INCLUDE_LOG_INFO;
}
+ if ( $this->fld_tags ) {
+ $includeFields[] =
WatchedItemQueryService::INCLUDE_TAGS;
+ }
return $includeFields;
}
@@ -391,6 +395,16 @@
}
}
+ if ( $this->fld_tags ) {
+ if ( $recentChangeInfo['rc_tags'] ) {
+ $tags = explode( ',',
$recentChangeInfo['rc_tags'] );
+ ApiResult::setIndexedTagName( $tags, 'tag' );
+ $vals['tags'] = $tags;
+ } else {
+ $vals['tags'] = [];
+ }
+ }
+
if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] &
Revision::DELETED_RESTRICTED ) ) {
$vals['suppressed'] = true;
}
@@ -453,6 +467,7 @@
'sizes',
'notificationtimestamp',
'loginfo',
+ 'tags',
]
],
'show' => [
diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json
index cceed01..a897f06 100644
--- a/includes/api/i18n/en.json
+++ b/includes/api/i18n/en.json
@@ -1331,6 +1331,7 @@
"apihelp-query+watchlist-paramvalue-prop-sizes": "Adds the old and new
lengths of the page.",
"apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "Adds
timestamp of when the user was last notified about the edit.",
"apihelp-query+watchlist-paramvalue-prop-loginfo": "Adds log
information where appropriate.",
+ "apihelp-query+watchlist-paramvalue-prop-tags": "Lists tags for the
entry.",
"apihelp-query+watchlist-param-show": "Show only items that meet these
criteria. For example, to see only minor edits done by logged-in users, set
$1show=minor|!anon.",
"apihelp-query+watchlist-param-type": "Which types of changes to show:",
"apihelp-query+watchlist-paramvalue-type-edit": "Regular page edits.",
diff --git a/includes/api/i18n/qqq.json b/includes/api/i18n/qqq.json
index d21f29c..1e4bfc8 100644
--- a/includes/api/i18n/qqq.json
+++ b/includes/api/i18n/qqq.json
@@ -1245,6 +1245,7 @@
"apihelp-query+watchlist-paramvalue-prop-sizes":
"{{doc-apihelp-paramvalue|query+watchlist|prop|sizes}}",
"apihelp-query+watchlist-paramvalue-prop-notificationtimestamp":
"{{doc-apihelp-paramvalue|query+watchlist|prop|notificationtimestamp}}",
"apihelp-query+watchlist-paramvalue-prop-loginfo":
"{{doc-apihelp-paramvalue|query+watchlist|prop|loginfo}}",
+ "apihelp-query+watchlist-paramvalue-prop-tags":
"{{doc-apihelp-paramvalue|query+watchlist|prop|tags}}",
"apihelp-query+watchlist-param-show":
"{{doc-apihelp-param|query+watchlist|show}}",
"apihelp-query+watchlist-param-type":
"{{doc-apihelp-param|query+watchlist|type}}",
"apihelp-query+watchlist-paramvalue-type-edit":
"{{doc-apihelp-paramvalue|query+watchlist|type|edit}}",
diff --git a/includes/watcheditem/WatchedItemQueryService.php
b/includes/watcheditem/WatchedItemQueryService.php
index d0f45be..3478b08 100644
--- a/includes/watcheditem/WatchedItemQueryService.php
+++ b/includes/watcheditem/WatchedItemQueryService.php
@@ -27,6 +27,7 @@
const INCLUDE_PATROL_INFO = 'patrol';
const INCLUDE_SIZES = 'sizes';
const INCLUDE_LOG_INFO = 'loginfo';
+ const INCLUDE_TAGS = 'tags';
// FILTER_* constants are part of public API (are used in
ApiQueryWatchlist and
// ApiQueryWatchlistRaw classes) and should not be changed.
@@ -335,6 +336,9 @@
if ( in_array( self::INCLUDE_COMMENT, $options['includeFields']
) ) {
$tables +=
$this->getCommentStore()->getJoin()['tables'];
}
+ if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] )
) {
+ $tables[] = 'tag_summary';
+ }
return $tables;
}
@@ -383,6 +387,10 @@
}
if ( in_array( self::INCLUDE_LOG_INFO,
$options['includeFields'] ) ) {
$fields = array_merge( $fields, [ 'rc_logid',
'rc_log_type', 'rc_log_action', 'rc_params' ] );
+ }
+ if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] )
) {
+ // prefixed with rc_ to include the field in
getRecentChangeFieldsFromRow
+ $fields['rc_tags'] = 'ts_tags';
}
return $fields;
@@ -678,6 +686,9 @@
if ( in_array( self::INCLUDE_COMMENT, $options['includeFields']
) ) {
$joinConds +=
$this->getCommentStore()->getJoin()['joins'];
}
+ if ( in_array( self::INCLUDE_TAGS, $options['includeFields'] )
) {
+ $joinConds['tag_summary'] = [ 'LEFT JOIN', [
'rc_id=ts_rc_id' ] ];
+ }
return $joinConds;
}
--
To view, visit https://gerrit.wikimedia.org/r/395821
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9e9ab9753ec0f813e9e555106cc81fd15ad9fb4a
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Schnark <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits