From 9832d2af8b17653404dd1810daf4018b41d0956a Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 5 Apr 2019 17:33:28 -0700 Subject: [PATCH] Don't use {$this->type} in message keys where not needed It makes the code less clear and makes message keys harder to grep for. Change-Id: I0641e7cd0b8262d8b6548a06d505e19c1b5a1fb0 --- includes/formatters/EchoForeignPresentationModel.php | 4 ++-- includes/formatters/EditUserTalkPresentationModel.php | 8 ++++---- includes/formatters/PageLinkedPresentationModel.php | 4 ++-- includes/formatters/RevertedPresentationModel.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/formatters/EchoForeignPresentationModel.php b/includes/formatters/EchoForeignPresentationModel.php index 0d040dfc9..dc9f80875 100644 --- a/includes/formatters/EchoForeignPresentationModel.php +++ b/includes/formatters/EchoForeignPresentationModel.php @@ -15,7 +15,7 @@ class EchoForeignPresentationModel extends EchoEventPresentationModel { // notification-header-foreign-alert // notification-header-foreign-notice - return "notification-header-{$this->type}-{$section}"; + return "notification-header-foreign-{$section}"; } public function getHeaderMessage() { @@ -33,7 +33,7 @@ class EchoForeignPresentationModel extends EchoEventPresentationModel { public function getBodyMessage() { $data = $this->event->getExtra(); - $msg = wfMessage( "notification-body-{$this->type}" ); + $msg = wfMessage( 'notification-body-foreign' ); $msg->params( $this->language->listToText( $this->getWikiNames( $data['wikis'] ) ) ); return $msg; } diff --git a/includes/formatters/EditUserTalkPresentationModel.php b/includes/formatters/EditUserTalkPresentationModel.php index cdf19046d..091bafb33 100644 --- a/includes/formatters/EditUserTalkPresentationModel.php +++ b/includes/formatters/EditUserTalkPresentationModel.php @@ -49,7 +49,7 @@ class EchoEditUserTalkPresentationModel extends EchoEventPresentationModel { public function getHeaderMessage() { if ( $this->isBundled() ) { - $msg = $this->msg( "notification-bundle-header-{$this->type}-v2" ); + $msg = $this->msg( 'notification-bundle-header-edit-user-talk-v2' ); $count = $this->getNotificationCountForOutput(); // Repeat is B/C until unused parameter is removed from translations @@ -57,7 +57,7 @@ class EchoEditUserTalkPresentationModel extends EchoEventPresentationModel { $msg->params( $this->getViewingUserForGender() ); return $msg; } elseif ( $this->section->exists() ) { - $msg = $this->getMessageWithAgent( "notification-header-{$this->type}-with-section" ); + $msg = $this->getMessageWithAgent( 'notification-header-edit-user-talk-with-section' ); $msg->params( $this->getViewingUserForGender() ); $msg->plaintextParams( $this->section->getTruncatedSectionTitle() ); return $msg; @@ -71,8 +71,8 @@ class EchoEditUserTalkPresentationModel extends EchoEventPresentationModel { public function getCompactHeaderMessage() { $hasSection = $this->section->exists(); $key = $hasSection - ? "notification-compact-header-{$this->type}-with-section" - : "notification-compact-header-{$this->type}"; + ? 'notification-compact-header-edit-user-talk-with-section' + : 'notification-compact-header-edit-user-talk'; $msg = $this->getMessageWithAgent( $key ); $msg->params( $this->getViewingUserForGender() ); if ( $hasSection ) { diff --git a/includes/formatters/PageLinkedPresentationModel.php b/includes/formatters/PageLinkedPresentationModel.php index 3941484ba..ceb53e5c2 100644 --- a/includes/formatters/PageLinkedPresentationModel.php +++ b/includes/formatters/PageLinkedPresentationModel.php @@ -58,9 +58,9 @@ class EchoPageLinkedPresentationModel extends EchoEventPresentationModel { protected function getHeaderMessageKey() { if ( $this->getBundleCount( true, [ $this, 'getLinkedPageId' ] ) > 1 ) { - return "notification-bundle-header-{$this->type}"; + return 'notification-bundle-header-page-linked'; } - return "notification-header-{$this->type}"; + return 'notification-header-page-linked'; } public function getHeaderMessage() { diff --git a/includes/formatters/RevertedPresentationModel.php b/includes/formatters/RevertedPresentationModel.php index 51918ae09..79c3e5afe 100644 --- a/includes/formatters/RevertedPresentationModel.php +++ b/includes/formatters/RevertedPresentationModel.php @@ -20,7 +20,7 @@ class EchoRevertedPresentationModel extends EchoEventPresentationModel { public function getBodyMessage() { $summary = $this->event->getExtraParam( 'summary' ); if ( !$this->isAutomaticSummary( $summary ) && $this->userCan( Revision::DELETED_COMMENT ) ) { - $msg = $this->msg( "notification-body-{$this->type}" ); + $msg = $this->msg( 'notification-body-reverted' ); $msg->plaintextParams( $this->formatSummary( $summary ) ); return $msg; } else {