Action::getPageTitle() should return a Message

Bug: T343994
Change-Id: Ice968d8a5651a21260b9389526b4f7694b3deca8
This commit is contained in:
Bartosz Dziewoński 2023-09-21 22:17:15 +02:00
parent e825084546
commit 19fa706693
4 changed files with 6 additions and 6 deletions

View file

@ -156,6 +156,7 @@
"discussiontools-topicheader-authorcount": "$1 {{PLURAL:$1|person|people}} in discussion", "discussiontools-topicheader-authorcount": "$1 {{PLURAL:$1|person|people}} in discussion",
"discussiontools-topicheader-commentcount": "$1 {{PLURAL:$1|comment|comments}}", "discussiontools-topicheader-commentcount": "$1 {{PLURAL:$1|comment|comments}}",
"discussiontools-topicheader-latestcomment": "Latest comment: $1", "discussiontools-topicheader-latestcomment": "Latest comment: $1",
"discussiontools-topicsubscription-action-title": "$1{{int:pipe-separator}}$2",
"discussiontools-topicsubscription-action-subscribe-button": "Subscribe", "discussiontools-topicsubscription-action-subscribe-button": "Subscribe",
"discussiontools-topicsubscription-action-subscribe-prompt": "Subscribe to this topic?", "discussiontools-topicsubscription-action-subscribe-prompt": "Subscribe to this topic?",
"discussiontools-topicsubscription-action-subscribe-prompt-newtopics": "Subscribe to notifications about new topics on this page?", "discussiontools-topicsubscription-action-subscribe-prompt-newtopics": "Subscribe to notifications about new topics on this page?",

View file

@ -170,6 +170,7 @@
"discussiontools-topicheader-authorcount": "Label showing how many users have commented in a discussion.", "discussiontools-topicheader-authorcount": "Label showing how many users have commented in a discussion.",
"discussiontools-topicheader-commentcount": "Label showing how many comments have been posted in a discussion. for languages without plural counters, just apply <nowiki> {{PLURAL:$1|[''comment''_in_your_language]}}</nowiki>, but never delete the template or it triggers error alert.", "discussiontools-topicheader-commentcount": "Label showing how many comments have been posted in a discussion. for languages without plural counters, just apply <nowiki> {{PLURAL:$1|[''comment''_in_your_language]}}</nowiki>, but never delete the template or it triggers error alert.",
"discussiontools-topicheader-latestcomment": "Label showing when the most recent comment was posted in a discussion. Parameters:\n* $1 When the comment was posted, e.g. '1 hour ago'. This text is a link to the comment.", "discussiontools-topicheader-latestcomment": "Label showing when the most recent comment was posted in a discussion. Parameters:\n* $1 When the comment was posted, e.g. '1 hour ago'. This text is a link to the comment.",
"discussiontools-topicsubscription-action-title": "Shown as page title when subscribing to or unsubscribing from a topic on a page. Parameters:\n* $1 - title of the page\n* $2 - title of the topic",
"discussiontools-topicsubscription-action-subscribe-button": "Button to subscribe to a topic.\n{{identical|Subscribe}}", "discussiontools-topicsubscription-action-subscribe-button": "Button to subscribe to a topic.\n{{identical|Subscribe}}",
"discussiontools-topicsubscription-action-subscribe-prompt": "Prompt shown when about to subscribe to a topic on an action page.", "discussiontools-topicsubscription-action-subscribe-prompt": "Prompt shown when about to subscribe to a topic on an action page.",
"discussiontools-topicsubscription-action-subscribe-prompt-newtopics": "Prompt shown when about to subscribe to notifications about new topics on an action page.", "discussiontools-topicsubscription-action-subscribe-prompt-newtopics": "Prompt shown when about to subscribe to notifications about new topics on an action page.",

View file

@ -35,9 +35,8 @@ class SubscribeAction extends FormAction {
protected function getPageTitle() { protected function getPageTitle() {
if ( $this->subscriptionTitle && !str_starts_with( $this->subscriptionName, 'p-topics-' ) ) { if ( $this->subscriptionTitle && !str_starts_with( $this->subscriptionName, 'p-topics-' ) ) {
$title = $this->subscriptionTitle; $title = $this->subscriptionTitle;
return htmlspecialchars( $title->getPrefixedText() ) . return $this->msg( 'discussiontools-topicsubscription-action-title' )
$this->msg( 'pipe-separator' )->escaped() . ->plaintextParams( $title->getPrefixedText(), $title->getFragment() );
htmlspecialchars( $title->getFragment() );
} else { } else {
return parent::getPageTitle(); return parent::getPageTitle();
} }

View file

@ -35,9 +35,8 @@ class UnsubscribeAction extends FormAction {
protected function getPageTitle() { protected function getPageTitle() {
if ( $this->subscriptionItem && !str_starts_with( $this->subscriptionItem->getItemName(), 'p-topics-' ) ) { if ( $this->subscriptionItem && !str_starts_with( $this->subscriptionItem->getItemName(), 'p-topics-' ) ) {
$title = Title::newFromLinkTarget( $this->subscriptionItem->getLinkTarget() ); $title = Title::newFromLinkTarget( $this->subscriptionItem->getLinkTarget() );
return htmlspecialchars( $title->getPrefixedText() ) . return $this->msg( 'discussiontools-topicsubscription-action-title' )
$this->msg( 'pipe-separator' )->escaped() . ->plaintextParams( $title->getPrefixedText(), $title->getFragment() );
htmlspecialchars( $title->getFragment() );
} else { } else {
return parent::getPageTitle(); return parent::getPageTitle();
} }