mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
Merge "Fix lego messages in 'user-rights' notification"
This commit is contained in:
commit
e750abdf43
|
@ -92,9 +92,9 @@
|
||||||
"notification-header-mention-article-talkpage": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the '''$4''' talk page in \"$5\".",
|
"notification-header-mention-article-talkpage": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the '''$4''' talk page in \"$5\".",
|
||||||
"notification-header-mention-article-talkpage-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the '''$4''' talk page.",
|
"notification-header-mention-article-talkpage-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the '''$4''' 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-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-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-user-rights-add": "You are now a member of {{PLURAL:$2|this group|these groups}}: $1",
|
"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-user-rights-remove": "You are no longer a member of {{PLURAL:$2|this group|these groups}}: $1",
|
"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-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-header-welcome": "{{GENDER:$2|Welcome}} to {{SITENAME}}, $1! We're glad {{GENDER:$2|you're}} here.",
|
||||||
"notification-welcome-link": "",
|
"notification-welcome-link": "",
|
||||||
|
|
|
@ -113,9 +113,9 @@
|
||||||
"notification-header-mention-article-talkpage": "Header text for a notification when you are mentioned by another user in a section on an article talk page.\n* $1 - user's name (not suitable for GENDER).\n* $2 - user's name for use in GENDER.\n* $3 - name of the user viewing the notification, can be used for GENDER\n* $4 - name of the article whose talk page you are mentioned in (without namespace).\n* $5 - name of the section they were mentioned in",
|
"notification-header-mention-article-talkpage": "Header text for a notification when you are mentioned by another user in a section on an article talk page.\n* $1 - user's name (not suitable for GENDER).\n* $2 - user's name for use in GENDER.\n* $3 - name of the user viewing the notification, can be used for GENDER\n* $4 - name of the article whose talk page you are mentioned in (without namespace).\n* $5 - name of the section they were mentioned in",
|
||||||
"notification-header-mention-article-talkpage-nosection": "Header text for a notification when you are mentioned by another user on an article talk page.\n* $1 - user's name (not suitable for GENDER).\n* $2 - user's name for use in GENDER.\n* $3 - name of the user viewing the notification, can be used for GENDER\n* $4 - name of the article whose talk page you are mentioned in (without namespace)",
|
"notification-header-mention-article-talkpage-nosection": "Header text for a notification when you are mentioned by another user on an article talk page.\n* $1 - user's name (not suitable for GENDER).\n* $2 - user's name for use in GENDER.\n* $3 - name of the user viewing the notification, can be used for GENDER\n* $4 - name of the article whose talk page you are mentioned in (without namespace)",
|
||||||
"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-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-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-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-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-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-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-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-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}}",
|
"notification-welcome-link": "{{notranslate}}",
|
||||||
|
|
|
@ -10,39 +10,37 @@ class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeaderMessage() {
|
public function getHeaderMessage() {
|
||||||
$msg = parent::getHeaderMessage();
|
list( $formattedName, $genderName ) = $this->getAgentForOutput();
|
||||||
// @todo fix lego message
|
$add = $this->getLocalizedGroupNames( $this->event->getExtraParam( 'add', array() ) );
|
||||||
$msg->params( $this->getChangedGroups() );
|
$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 $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:
|
private function getLocalizedGroupNames( $names ) {
|
||||||
// * notification-user-rights-add
|
return array_map( function( $name ) {
|
||||||
// * notification-user-rights-remove
|
$msg = $this->msg( 'group-' . $name );
|
||||||
$list[] = $this->msg( 'notification-user-rights-' . $action )
|
return $msg->isBlank() ? $name : $msg->text();
|
||||||
->params( $this->language->commaList( $groups ), count( $groups ) )
|
}, $names );
|
||||||
->text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->language->semicolonList( $list );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPrimaryLink() {
|
public function getPrimaryLink() {
|
||||||
|
|
Loading…
Reference in a new issue