mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Fix lego messages in 'user-rights' notification
Bug: T121661 Change-Id: I8386429a36182dbc44b45990506a42cbeef115ad
This commit is contained in:
parent
d0425ac746
commit
2c7136ecb7
|
@ -86,9 +86,9 @@
|
|||
"notification-mention-nosection": "[[User:$1|$1]] {{GENDER:$1|mentioned}} {{GENDER:$4|you}} on the [[:$3|$2 talk page]].",
|
||||
"notification-header-mention-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$5|you}} on the $3 talk page.",
|
||||
"notification-user-rights": "Your user rights [[Special:Log/rights/$1|were {{GENDER:$1|changed}}]] by [[User:$1|$1]]. $2. [[Special:ListGroupRights|Learn more]]",
|
||||
"notification-header-user-rights": "Your user rights were {{GENDER:$2|changed}} by $1. $3.",
|
||||
"notification-user-rights-add": "You are now a member of {{PLURAL:$2|this group|these groups}}: $1",
|
||||
"notification-user-rights-remove": "You are no longer a member of {{PLURAL:$2|this group|these groups}}: $1",
|
||||
"notification-header-user-rights-add-only": "Your user rights were {{GENDER:$1|changed}}: You are now a member of the $2 {{PLURAL:$3|group|groups}}.",
|
||||
"notification-header-user-rights-remove-only": "Your user rights were {{GENDER:$1|changed}}: You are no longer a member of the $2 {{PLURAL:$3|group|groups}}.",
|
||||
"notification-header-user-rights-add-and-remove": "Your user rights were {{GENDER:$1|changed}}: You are now a member of the $2 {{PLURAL:$3|group|groups}}. You are no longer a member of the $4 {{PLURAL:$5|group|groups}}.",
|
||||
"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": "",
|
||||
|
|
|
@ -107,9 +107,9 @@
|
|||
"notification-mention-nosection": "Format for displaying notifications of a comment including a link to another user's user page. Parameters:\n* $1 - the username of the person who edited, plain text. Can be used for GENDER\n* $2 - the title text without namespace (a page title in any namespace)\n* $3 - the page title of the discussion\n* $4 - name of the user viewing the notification, can be used for GENDER",
|
||||
"notification-header-mention-nosection": "Header text for a notification when you are mentioned by another user, but not in a section of a page.\n* $1 - user's name (not suitable for GENDER).\n* $2 - user's name for use in GENDER.\n* $3 - name of the page without namespace they were mentioned in.\n* $4 - full page name.\n* $5 - name of the user viewing the notification, can be used for GENDER",
|
||||
"notification-user-rights": "Format for displaying notifications of a user right change in notification page.\n\nParameters:\n* $1 - the username of the person who made the user right change. Can be used for GENDER support.\n* $2 - a semicolon separated list of {{msg-mw|Notification-user-rights-add}}, {{msg-mw|Notification-user-rights-remove}}",
|
||||
"notification-header-user-rights": "Format for displaying notifications of a user right change in notification flyout. Parameters:\n* $1 - the username of the person who made the user right change, formatted for display. Cannot be used for GENDER\n* $2 - the raw username of the person who made the user rights change, can be used for GENDER support\n* $3 - a semicolon separated list of {{msg-mw|notification-user-rights-add}}, {{msg-mw|notification-user-rights-remove}}",
|
||||
"notification-user-rights-add": "Message indicating that a user was added to a user group. Parameters:\n* $1 - a comma separated list of user group names\n* $2 - the number of user groups, this is used for PLURAL support\nSee also:\n* {{msg-mw|Notification-user-rights-remove}}",
|
||||
"notification-user-rights-remove": "Message indicating that a user was removed from a user group. Parameters:\n* $1 - a comma separated list of user group names\n* $2 - the number of user groups, this is used for PLURAL support\nSee also:\n* {{msg-mw|Notification-user-rights-add}}",
|
||||
"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",
|
||||
"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",
|
||||
"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* $3 - the number of groups that were added, can be used for PLURAL\n* $4 - a localized list of the groups that were removed\n* $5 - the number of groups that were removed, can be used for PLURAL",
|
||||
"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.Parameters:\n* $1 - the formatted username of the new user\n* $2 - the username for gender purposes\nSee also:\n* {{msg-mw|Guidedtour-tour-gettingstarted-start-title}}",
|
||||
"notification-welcome-link": "{{notranslate}}",
|
||||
|
|
|
@ -10,39 +10,37 @@ class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
|
||||
public function getHeaderMessage() {
|
||||
$msg = parent::getHeaderMessage();
|
||||
// @todo fix lego message
|
||||
$msg->params( $this->getChangedGroups() );
|
||||
|
||||
return $msg;
|
||||
list( $formattedName, $genderName ) = $this->getAgentForOutput();
|
||||
$add = $this->getLocalizedGroupNames( $this->event->getExtraParam( 'add', array() ) );
|
||||
$remove = $this->getLocalizedGroupNames( $this->event->getExtraParam( 'remove', array() ) );
|
||||
if ( $add && !$remove ) {
|
||||
$msg = $this->msg( 'notification-header-user-rights-add-only' );
|
||||
$msg->params( $genderName );
|
||||
$msg->params( $this->language->listToText( $add ) );
|
||||
$msg->params( count( $add ) );
|
||||
return $msg;
|
||||
} elseif ( !$add && $remove ) {
|
||||
$msg = $this->msg( 'notification-header-user-rights-remove-only' );
|
||||
$msg->params( $genderName );
|
||||
$msg->params( $this->language->listToText( $remove ) );
|
||||
$msg->params( count( $remove ) );
|
||||
return $msg;
|
||||
} else {
|
||||
$msg = $this->msg( 'notification-header-user-rights-add-and-remove' );
|
||||
$msg->params( $genderName );
|
||||
$msg->params( $this->language->listToText( $add ) );
|
||||
$msg->params( count( $add ) );
|
||||
$msg->params( $this->language->listToText( $remove ) );
|
||||
$msg->params( count( $remove ) );
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getChangedGroups() {
|
||||
$list = array();
|
||||
$extra = $this->event->getExtra();
|
||||
foreach ( array( 'add', 'remove' ) as $action ) {
|
||||
if ( isset( $extra[$action] ) && $extra[$action] ) {
|
||||
|
||||
// Get the localized group names, bug 55338
|
||||
$groups = array();
|
||||
foreach ( $extra[$action] as $group ) {
|
||||
$msg = $this->msg( 'group-' . $group );
|
||||
$groups[] = $msg->isBlank() ? $group : $msg->text();
|
||||
}
|
||||
|
||||
// Messages that can be used here:
|
||||
// * notification-user-rights-add
|
||||
// * notification-user-rights-remove
|
||||
$list[] = $this->msg( 'notification-user-rights-' . $action )
|
||||
->params( $this->language->commaList( $groups ), count( $groups ) )
|
||||
->text();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->language->semicolonList( $list );
|
||||
private function getLocalizedGroupNames( $names ) {
|
||||
return array_map( function( $name ) {
|
||||
$msg = $this->msg( 'group-' . $name );
|
||||
return $msg->isBlank() ? $name : $msg->text();
|
||||
}, $names );
|
||||
}
|
||||
|
||||
public function getPrimaryLink() {
|
||||
|
|
Loading…
Reference in a new issue