mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
Support GENDER in mention-on-user-talk messages
Also refactored getHeaderMessageKey for grep-ability Bug: T56433 Change-Id: Ia844c3e0008c7ed24dcc093e3eab41decbcaeb2a
This commit is contained in:
parent
779b7030d9
commit
475d724b45
|
@ -85,8 +85,8 @@
|
|||
"notification-mention-nosection": "[[User:$1|$1]] {{GENDER:$1|mentioned}} {{GENDER:$4|you}} on the [[:$3|$2 talk page]].",
|
||||
"notification-header-mention-other": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on '''$4''' in \"$5\".",
|
||||
"notification-header-mention-other-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on '''$4'''.",
|
||||
"notification-header-mention-user-talkpage": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the user talk page of '''$4''' in \"$5\".",
|
||||
"notification-header-mention-user-talkpage-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the user talk page of '''$4'''.",
|
||||
"notification-header-mention-user-talkpage-v2": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the user talk page {{GENDER:$5|of}} '''$4''' in \"$6\".",
|
||||
"notification-header-mention-user-talkpage-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the user talk page {{GENDER:$5|of}} '''$4'''.",
|
||||
"notification-header-mention-agent-talkpage": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on {{GENDER:$2|his|her|their}} talk page in \"$4\".",
|
||||
"notification-header-mention-agent-talkpage-nosection": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on {{GENDER:$2|his|her|their}} talk page.",
|
||||
"notification-header-mention-article-talkpage": "$1 {{GENDER:$2|mentioned}} {{GENDER:$3|you}} on the '''$4''' talk page in \"$5\".",
|
||||
|
|
|
@ -106,8 +106,8 @@
|
|||
"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-other": "Header text for a notification when you are mentioned by another user in a section on a page that is not an article talk page or a user 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 page they were mentioned in (with namespace).\n* $5 - name of the section they were mentioned in",
|
||||
"notification-header-mention-other-nosection": "Header text for a notification when you are mentioned by another user on a page that is not an article talk page or a user 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 page they were mentioned in (with namespace)",
|
||||
"notification-header-mention-user-talkpage": "Header text for a notification when you are mentioned by another user in a section on a user 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 user whose talk page you are mentioned in (without namespace).\n* $5 - name of the section they were mentioned in",
|
||||
"notification-header-mention-user-talkpage-nosection": "Header text for a notification when you are mentioned by another user on a user 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 user whose talk page you are mentioned in (with namespace)",
|
||||
"notification-header-mention-user-talkpage-v2": "Header text for a notification when you are mentioned by another user in a section on a user 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 - formatted name of the user whose talk page you are mentioned in.\n* $5 - name of the user whose talk page you are mentioned in, can be used for GENDER\n* $6 - name of the section they were mentioned in",
|
||||
"notification-header-mention-user-talkpage-nosection": "Header text for a notification when you are mentioned by another user on a user 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 user whose talk page you are mentioned in\n* $5 - name of the user whose talk page you are mentioned in, can be used for GENDER",
|
||||
"notification-header-mention-agent-talkpage": "Header text for a notification when you are mentioned by another user in a section on their 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 section they were mentioned in",
|
||||
"notification-header-mention-agent-talkpage-nosection": "Header text for a notification when you are mentioned by another user on their 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",
|
||||
"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",
|
||||
|
|
|
@ -32,32 +32,25 @@ class EchoMentionPresentationModel extends EchoEventPresentationModel {
|
|||
}
|
||||
|
||||
protected function getHeaderMessageKey() {
|
||||
// Messages used:
|
||||
// notification-header-mention-other
|
||||
// notification-header-mention-other-nosection
|
||||
// notification-header-mention-article-talkpage
|
||||
// notification-header-mention-article-talkpage-nosection
|
||||
// notification-header-mention-agent-talkpage
|
||||
// notification-header-mention-agent-talkpage-nosection
|
||||
// notification-header-mention-user-talkpage
|
||||
// notification-header-mention-user-talkpage-nosection
|
||||
$key = 'notification-header-mention';
|
||||
$noSection = !$this->getSection();
|
||||
|
||||
if ( $this->onArticleTalkpage() ) {
|
||||
$key .= '-article-talkpage';
|
||||
return $noSection ?
|
||||
'notification-header-mention-article-talkpage-nosection' :
|
||||
'notification-header-mention-article-talkpage';
|
||||
} elseif ( $this->onAgentTalkpage() ) {
|
||||
$key .= '-agent-talkpage';
|
||||
return $noSection ?
|
||||
'notification-header-mention-agent-talkpage-nosection' :
|
||||
'notification-header-mention-agent-talkpage';
|
||||
} elseif ( $this->onUserTalkpage() ) {
|
||||
$key .= '-user-talkpage';
|
||||
return $noSection ?
|
||||
'notification-header-mention-user-talkpage-nosection' :
|
||||
'notification-header-mention-user-talkpage-v2';
|
||||
} else {
|
||||
$key .= '-other';
|
||||
return $noSection ?
|
||||
'notification-header-mention-other-nosection' :
|
||||
'notification-header-mention-other';
|
||||
}
|
||||
|
||||
if ( !$this->getSection() ) {
|
||||
$key .= '-nosection';
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
public function getHeaderMessage() {
|
||||
|
@ -71,7 +64,9 @@ class EchoMentionPresentationModel extends EchoEventPresentationModel {
|
|||
// If we remove this check, onUserTalkpage() has to
|
||||
// make sure it is a user talk page but NOT the agent's talk page.
|
||||
} elseif ( $this->onUserTalkpage() ) {
|
||||
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle() ) );
|
||||
$username = $this->event->getTitle()->getText();
|
||||
$msg->params( $this->language->truncate( $username, self::USERNAME_RECOMMENDED_LENGTH ) );
|
||||
$msg->params( $username );
|
||||
} else {
|
||||
$msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue