Matthias Mullie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/337565 )

Change subject: Enable extensions to allow software-specific tags to be added 
by users
......................................................................

Enable extensions to allow software-specific tags to be added by users

Bug: T121880
Bug: T121872
Change-Id: I6e054cfc065c8d8ae7d20a518b1963cd0551c5c2
---
M RELEASE-NOTES-1.29
M docs/hooks.txt
M includes/changetags/ChangeTags.php
3 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/337565/1

diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29
index 3ba6577..8ec6629 100644
--- a/RELEASE-NOTES-1.29
+++ b/RELEASE-NOTES-1.29
@@ -52,6 +52,8 @@
   This might affect some forms that used them and only worked because the
   attributes were not actually being set.
 * Expiry times can now be specified when users are added to user groups.
+* Added 'ChangeTagsAllowedAdd' hook, enabling extensions to allow software-
+  specific tags to be added by users.
 
 === External library changes in 1.29 ===
 
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 846a073..298fa61b 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -1045,6 +1045,10 @@
 $rc: RecentChange being tagged when the tagging accompanies the action or null
 $user: User who performed the tagging when the tagging is subsequent to the 
action or null
 
+'ChangeTagsAllowedAdd': Called when checking if a user can add tags to a 
change.
+$allowedTags: List of tags allowed to add
+$user: User who is adding the tags
+
 'ChangeUserGroups': Called before user groups are changed.
 $performer: The User who will perform the change
 $user: The User whose groups will be changed
diff --git a/includes/changetags/ChangeTags.php 
b/includes/changetags/ChangeTags.php
index d2239eb..645bd26 100644
--- a/includes/changetags/ChangeTags.php
+++ b/includes/changetags/ChangeTags.php
@@ -402,8 +402,8 @@
                }
 
                // to be applied, a tag has to be explicitly defined
-               // @todo Allow extensions to define tags that can be applied by 
users...
                $allowedTags = self::listExplicitlyDefinedTags();
+               Hooks::run( 'ChangeTagsAllowedAdd', [ &$allowedTags, $user ] );
                $disallowedTags = array_diff( $tags, $allowedTags );
                if ( $disallowedTags ) {
                        return self::restrictedTagError( 
'tags-apply-not-allowed-one',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e054cfc065c8d8ae7d20a518b1963cd0551c5c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

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

Reply via email to