mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Merge "TagHooks: Make static method for obtaining DiscussionTools tags"
This commit is contained in:
commit
636ff45a75
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue