mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-24 02:39:33 +00:00
Merge "Include reason in user-rights notification body"
This commit is contained in:
commit
d1830041af
|
@ -556,10 +556,11 @@ class EchoHooks {
|
|||
* @param string[] $add strings corresponding to groups added
|
||||
* @param string[] $remove strings corresponding to groups removed
|
||||
* @param User|bool $performer
|
||||
* @param string|bool $reason Reason given by the user changing the rights
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function onUserGroupsChanged( $user, $add, $remove, $performer ) {
|
||||
public static function onUserGroupsChanged( $user, $add, $remove, $performer, $reason ) {
|
||||
if ( !$performer ) {
|
||||
// TODO: Implement support for autopromotion
|
||||
return true;
|
||||
|
@ -583,7 +584,8 @@ class EchoHooks {
|
|||
'extra' => array(
|
||||
'user' => $user->getID(),
|
||||
'add' => $add,
|
||||
'remove' => $remove
|
||||
'remove' => $remove,
|
||||
'reason' => $reason,
|
||||
),
|
||||
'agent' => $performer,
|
||||
)
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
"notification-header-user-rights-add-only": "{{GENDER:$4|Your}} user rights were {{GENDER:$1|changed}}. You have been added to: $2.",
|
||||
"notification-header-user-rights-remove-only": "{{GENDER:$4|Your}} user rights were {{GENDER:$1|changed}}. You are no longer a member of: $2.",
|
||||
"notification-header-user-rights-add-and-remove": "{{GENDER:$6|Your}} user rights were {{GENDER:$1|changed}}. You have been added to: $2. You are no longer a member of: $4.",
|
||||
"notification-body-user-rights": "$1",
|
||||
"notification-new-user": "Welcome to {{SITENAME}}, $1! We're glad you're here.",
|
||||
"notification-header-welcome": "{{GENDER:$2|Welcome}} to {{SITENAME}}, $1! We're glad {{GENDER:$2|you're}} here.",
|
||||
"notification-welcome-link": "",
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
"notification-header-user-rights-add-only": "Notifications header message when a user is added to groups. Parameters:\n* $1 - the raw username of the person who made the user rights change, can be used for GENDER support\n* $2 - a localized list of the groups that were added\n* $3 - the number of groups that were added, can be used for PLURAL\n* $4 - name of the user viewing the notification, can be used for GENDER",
|
||||
"notification-header-user-rights-remove-only": "Notifications header message when a user is removed from groups. Parameters:\n* $1 - the raw username of the person who made the user rights change, can be used for GENDER support\n* $2 - a localized list of the groups that were removed\n* $3 - the number of groups that were removed, can be used for PLURAL\n* $4 - name of the user viewing the notification, can be used for GENDER",
|
||||
"notification-header-user-rights-add-and-remove": "Notifications header message when a user is added to groups and removed from groups. Parameters:\n* $1 - the raw username of the person who made the user rights change, can be used for GENDER support\n* $2 - a localized list of the groups that were added\n* $4 - a localized list of the groups that were removed\n* $6 - name of the user viewing the notification, can be used for GENDER",
|
||||
"notification-body-user-rights": "{{notranslate}}",
|
||||
"notification-new-user": "Text of the welcome notification. Parameters:\n* $1 - the name of the new user\nSee also:\n* {{msg-mw|Guidedtour-tour-gettingstarted-start-title}}",
|
||||
"notification-header-welcome": "Text of the welcome notification. Parameters:\n* $1 - the name of the new user.\nSee also:\n* {{msg-mw|Guidedtour-tour-gettingstarted-start-title}}",
|
||||
"notification-welcome-link": "{{notranslate}}",
|
||||
|
|
|
@ -39,6 +39,11 @@ class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
}
|
||||
|
||||
public function getBodyMessage() {
|
||||
$reason = $this->event->getExtraParam( 'reason' );
|
||||
return $reason ? $this->msg( 'notification-body-user-rights' )->params( $reason ) : false;
|
||||
}
|
||||
|
||||
private function getLocalizedGroupNames( $names ) {
|
||||
return array_map( function( $name ) {
|
||||
$msg = $this->msg( 'group-' . $name );
|
||||
|
|
Loading…
Reference in a new issue