Merge "TagHooks: Make static method for obtaining DiscussionTools tags"

This commit is contained in:
jenkins-bot 2022-06-08 11:18:42 +00:00 committed by Gerrit Code Review
commit 636ff45a75

View file

@ -67,15 +67,23 @@ class TagHooks implements
if ( !defined( 'MW_API' ) ) {
return true;
}
$request = RequestContext::getMain()->getRequest();
$tags = explode( ',', $request->getText( 'dttags' ) );
$tags = array_values( array_intersect( $tags, static::TAGS ) );
$tags = self::getDiscussionToolsTagsFromRequest();
if ( $tags ) {
$recentChange->addTags( $tags );
}
return true;
}
/**
* Get DT tags from the dttags param in the request, and validate against known tags.
*
* @return array
*/
public static function getDiscussionToolsTagsFromRequest(): array {
$request = RequestContext::getMain()->getRequest();
$tags = explode( ',', $request->getText( 'dttags' ) );
return array_values( array_intersect( $tags, static::TAGS ) );
}
}