jenkins-bot has submitted this change and it was merged. Change subject: Change Echo notifications to use new formatter with presentation model ......................................................................
Change Echo notifications to use new formatter with presentation model Bug: T116848 Change-Id: I9990813c76c734e52190bbf66e3a99c38a9872eb --- M extension.json M i18n/en.json M i18n/qqq.json A includes/EchoGatherModerationHidePresentationModel.php A includes/EchoGatherModerationPresentationModel.php M includes/Gather.hooks.php 6 files changed, 100 insertions(+), 1 deletion(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index 216ab7f..3d9ad2f 100644 --- a/extension.json +++ b/extension.json @@ -55,6 +55,8 @@ "GatherAlias": "Gather.alias.php" }, "AutoloadClasses": { + "Gather\\EchoGatherModerationPresentationModel": "includes/EchoGatherModerationPresentationModel.php", + "Gather\\EchoGatherModerationHidePresentationModel": "includes/EchoGatherModerationHidePresentationModel.php", "Gather\\Hooks": "includes/Gather.hooks.php", "Gather\\UpdaterHooks": "schema/Updater.hooks.php", "Gather\\models\\CollectionItem": "includes/models/CollectionItem.php", diff --git a/i18n/en.json b/i18n/en.json index 2fb0cf5..6cae740 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -105,14 +105,24 @@ "gather-public": "Public", "gather-hidden": "Hidden", "gather-moderation-hidden": "[[$1|Your collection]] was hidden. This means that you are the only one who can see it. Collections are hidden if they go against our [[Project:Gather/Moderation_Criteria|moderation criteria]]. You can [[Project:Gather/User_Feedback|contest this]].", + "notification-header-gather-hide": "{{GENDER:$3|Your}} collection was hidden. This means that you are the only one who can see it. Collections are hidden if they go against the wiki's moderation criteria. You can contest the decision to hide the collection.", "gather-moderation-hidden-email-subject": "Your collection $1 was hidden.", - "gather-moderation-hidden-email-body": "Your collection $1 was hidden. This means that you are the only one who can see it. Collections are hidden if they go against our moderation criteria:\nhttps://en.wikipedia.org/wiki/Wikipedia:Gather/Moderation_Criteria\n\nYou can contest this on the following page:\nhttps://en.wikipedia.org/wiki/Wikipedia:Gather/User_Feedback", + "gather-moderation-hidden-email-body": "Your collection $1 was hidden. This means that you are the only one who can see it. Collections are hidden if they go against the wiki's moderation criteria:\nhttps://en.wikipedia.org/wiki/Wikipedia:Gather/Moderation_Criteria\n\nYou can contest this on the following page:\nhttps://en.wikipedia.org/wiki/Wikipedia:Gather/User_Feedback", "gather-moderation-unhidden": "[[$1|Your collection]] was unhidden. This means that it can be viewed publicly again. ", + "notification-header-gather-unhide": "{{GENDER:$3|Your}} collection was unhidden. This means that it can be viewed publicly again. ", "gather-moderation-unhidden-email-subject": "Your collection $1 was unhidden.", "gather-moderation-unhidden-email-body": "Your collection $1 was unhidden. This means that it can be viewed publicly again.", + "notification-header-gather-approve": "{{GENDER:$3|Your}} collection was approved. This means that it won't be automatically hidden again.", "gather-moderation-approved": "[[$1|Your collection]] was approved. This means that it won't be automatically hidden again.", "gather-moderation-approved-email-subject": "Your collection $1 was approved.", "gather-moderation-approved-email-body": "Your collection $1 was approved. This means that it won't be automatically hidden again.", + "gather-moderation-criteria-page": "{{ns:Project}}:Gather/Moderation Criteria", + "gather-moderation-criteria-link-label": "Moderation criteria", + "gather-moderation-criteria-link-description": "Reasons that certain collections are hidden", + "gather-moderation-dispute-page": "{{ns:Project}}:Gather/User Feedback", + "gather-moderation-dispute-link-label": "Contest", + "gather-moderation-dispute-link-description": "Dispute a moderation decision", + "gather-moderation-notification-primary-link-text": "{{GENDER:$1|Your}} collection", "echo-category-title-gather": "Gather", "gather-echo-pref-tooltip": "Notify me about changes to my collections.", "gather-article-count": "$1 {{PLURAL:$1|page|pages}}", diff --git a/i18n/qqq.json b/i18n/qqq.json index d7c2491..ef18a42 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -108,14 +108,24 @@ "gather-public": "Label for a collection when it is publicly visible\n{{Identical|Public}}", "gather-hidden": "Label for a collection when it has been hidden from the public by an administrator\n{{Identical|Hidden}}", "gather-moderation-hidden": "Label for echo notification explaining that your collection was hidden. Also providing links to moderation criteria and methods to contest your collection moderation. Parameters:\n* $1 - Url of collection.", + "notification-header-gather-hide": "Label for echo notification explaining that your collection was hidden. There will be secondary links to moderation criteria and methods to contest your collection moderation. The 'contest the decision' link is labelled with the message gather-moderation-dispute-link-label. Parameters:\n* $1 - Username of the user who hid the collection (not suitable for gender).\n* $2 - Username of the user who hid the collection, for gender.\n* $3 - Username of viewer, for gender.\n{{Related|gather-moderation-dispute-link-label}}", "gather-moderation-hidden-email-subject": "Label for echo notification email subject explaining that your collection was hidden.Parameters:\n* $1 - Url of collection.", "gather-moderation-hidden-email-body": "Label for echo notification email body explaining that your collection was hidden. Also providing links to moderation criteria and methods to contest your collection moderation. Parameters:\n* $1 - Url of collection.", "gather-moderation-unhidden": "Label for echo notification explaining that your collection was unhidden and that it can be viewed again as normal. Parameters:\n* $1 - Url of collection.", + "notification-header-gather-unhide": "Label for echo notification explaining that your collection was unhidden and that it can be viewed again as normal. Parameters:\n* $1 - Username of the user who unhid the collection (not suitable for gender).\n* $2 - Username of the user who unhid the collection, for gender.\n* $3 - Username of viewer, for gender.", "gather-moderation-unhidden-email-subject": "Label for echo notification email subject explaining that your collection was unhidden. Parameters:\n* $1 - Url of collection.", "gather-moderation-unhidden-email-body": "Label for echo notification email body explaining that your collection was unhidden. Parameters:\n* $1 - Url of collection.", "gather-moderation-approved": "Label for echo notification explaining that your collection was approved (ie. it won't be automatically hidden when a lot of users flag it). Parameters:\n* $1 - Url of collection.", + "notification-header-gather-approve": "Label for echo notification explaining that your collection was approved (ie. it won't be automatically hidden when a lot of users flag it). Parameters:\n* $1 - Username of the user who approved the collection (not suitable for gender).\n* $2 - Username of the user who approved the collection, for gender.\n* $3 - Username of viewer, for gender.", "gather-moderation-approved-email-subject": "Label for echo notification email subject explaining that your collection was approved. Parameters:\n* $1 - Url of collection.", "gather-moderation-approved-email-body": "Label for echo notification email body explaining that your collection was approved. Parameters:\n* $1 - Url of collection.", + "gather-moderation-notification-primary-link-text": "Label for primary link, pointing to the viewer collection, for moderation notifications.\n* $1 - Username of viewer, for gender.", + "gather-moderation-criteria-page": "Name of page containing criteria for moderating Gather collections", + "gather-moderation-criteria-link-label": "Label for moderation criteria link", + "gather-moderation-criteria-link-description": "Description for moderation criteria link", + "gather-moderation-dispute-page": "Name of page where users can dispute Gather moderation decisions", + "gather-moderation-dispute-link-label": "Label for moderation dispute link", + "gather-moderation-dispute-link-description": "Description for moderation dispute link", "echo-category-title-gather": "A label for the Gather checkboxes in the Echo notifications preferences.", "gather-echo-pref-tooltip": "This is a short description of the gather notification category in the Echo notifications preferences.\n{{Related|Echo-pref-tooltip}}", "gather-article-count": "Expression of the number of pages in a collection. Parameter:\n* $1 - number of pages in the collection\n{{Identical|Page}}", diff --git a/includes/EchoGatherModerationHidePresentationModel.php b/includes/EchoGatherModerationHidePresentationModel.php new file mode 100644 index 0000000..95aedd5 --- /dev/null +++ b/includes/EchoGatherModerationHidePresentationModel.php @@ -0,0 +1,37 @@ +<?php + +namespace Gather; + +use Title; + +class EchoGatherModerationHidePresentationModel extends EchoGatherModerationPresentationModel { + public function getSecondaryLinks() { + $criteriaTitle = Title::newFromText( + $this->msg( 'gather-moderation-criteria-page' )->inContentLanguage()->text() + ); + + $contestTitle = Title::newFromText( + $this->msg( 'gather-moderation-dispute-page' )->inContentLanguage()->text() + ); + + return array( + array( + 'url' => $criteriaTitle->getFullURL(), + 'label' => $this->msg( 'gather-moderation-criteria-link-label' )->text(), + 'description' => $this->msg( 'gather-moderation-criteria-link-description' )->text(), + 'icon' => false, + 'prioritized' => true, + ), + array( + 'url' => $contestTitle->getFullURL(), + 'label' => $this->msg( 'gather-moderation-dispute-link-label' )->text(), + 'description' => $this->msg( 'gather-moderation-dispute-link-description' )->text(), + 'icon' => false, + + // This could be made false, depending how much visibility this option requires. + // It could also be linked from the criteria page. + 'prioritized' => true, + ), + ); + } +} diff --git a/includes/EchoGatherModerationPresentationModel.php b/includes/EchoGatherModerationPresentationModel.php new file mode 100644 index 0000000..abd20b5 --- /dev/null +++ b/includes/EchoGatherModerationPresentationModel.php @@ -0,0 +1,37 @@ +<?php + +namespace Gather; + +use EchoEventPresentationModel; + +class EchoGatherModerationPresentationModel extends EchoEventPresentationModel { + public function canRender() { + // We only need to potentially block rendering if we're notifying someone + // other than the person who wrote the content. + + // We can just return true if we're only notifying the collection + // owner. + return true; + } + + public function getIconType() { + return 'placeholder'; + } + + public function getHeaderMessage() { + $msg = parent::getHeaderMessage(); + $msg->params( $this->getViewingUserForGender() ); + + return $msg; + } + + public function getPrimaryLink() { + $title = $this->event->getTitle(); + $labelMsg = $this->msg( 'gather-moderation-notification-primary-link-text' ); + + return array( + 'url' => $title->getFullURL(), + 'label' => $labelMsg->params( $this->getViewingUserForGender() )->text(), + ); + } +} diff --git a/includes/Gather.hooks.php b/includes/Gather.hooks.php index 9dc4a5e..e5e3f3f 100644 --- a/includes/Gather.hooks.php +++ b/includes/Gather.hooks.php @@ -75,6 +75,7 @@ $notifications['gather-hide'] = array( 'category' => 'gather', 'group' => 'negative', + 'presentation-model' => 'Gather\EchoGatherModerationHidePresentationModel', 'title-message' => 'gather-moderation-hidden', 'title-params' => array( 'title' ), 'email-subject-message' => 'gather-moderation-hidden-email-subject', @@ -86,6 +87,7 @@ $notifications['gather-unhide'] = array( 'category' => 'gather', 'group' => 'positive', + 'presentation-model' => 'Gather\EchoGatherModerationPresentationModel', 'title-message' => 'gather-moderation-unhidden', 'title-params' => array( 'title' ), 'email-subject-message' => 'gather-moderation-unhidden-email-subject', @@ -97,6 +99,7 @@ $notifications['gather-approve'] = array( 'category' => 'gather', 'group' => 'positive', + 'presentation-model' => 'Gather\EchoGatherModerationPresentationModel', 'title-message' => 'gather-moderation-approved', 'title-params' => array( 'title' ), 'email-subject-message' => 'gather-moderation-approved-email-subject', -- To view, visit https://gerrit.wikimedia.org/r/256635 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9990813c76c734e52190bbf66e3a99c38a9872eb Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: dev Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits