*/
class ApiQueryWatchlist extends ApiQueryGeneratorBase {
+ /** @var CommentStore */
private $commentStore;
public function __construct( ApiQuery $query, $moduleName ) {
$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
$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() ) {
if ( $this->fld_loginfo ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
}
+ if ( $this->fld_tags ) {
+ $includeFields[] = WatchedItemQueryService::INCLUDE_TAGS;
+ }
return $includeFields;
}
private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
/* Determine the title of the page that has been changed. */
- $title = Title::makeTitle(
- $watchedItem->getLinkTarget()->getNamespace(),
- $watchedItem->getLinkTarget()->getDBkey()
- );
+ $title = Title::newFromLinkTarget( $watchedItem->getLinkTarget() );
$user = $this->getUser();
/* Our output data. */
}
}
+ 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;
}
'sizes',
'notificationtimestamp',
'loginfo',
+ 'tags',
]
],
'show' => [