jenkins-bot has submitted this change and it was merged.
Change subject: Rephrase notifications
......................................................................
Rephrase notifications
Add links to thank and discuss.
Bug: T125693
Depends-On: I5578f176024063584cda452b26436bc59c37fee8
Change-Id: Ib6ec612db042c434b5dc14a7e9027f585f2e4057
---
M PageTriage.php
M api/ApiPageTriageAction.php
M api/ApiPageTriageTagging.php
M i18n/en.json
M i18n/qqq.json
M includes/Notifications/PageTriageAddDeletionTagPresentationModel.php
M includes/Notifications/PageTriageAddMaintenanceTagPresentationModel.php
M includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php
A includes/Notifications/PageTriagePresentationModel.php
9 files changed, 126 insertions(+), 84 deletions(-)
Approvals:
Mattflaschen: Looks good to me, approved
Siebrand: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/PageTriage.php b/PageTriage.php
index bd3c060..439f831 100644
--- a/PageTriage.php
+++ b/PageTriage.php
@@ -144,6 +144,8 @@
. 'includes/PageTriageLogFormatter.php';
$wgAutoloadClasses['PageTriageNotificationFormatter'] = $dir
. 'includes/Notifications/PageTriageNotificationFormatter.php';
+$wgAutoloadClasses['PageTriagePresentationModel'] = $dir
+ . 'includes/Notifications/PageTriagePresentationModel.php';
$wgAutoloadClasses['PageTriageMarkAsReviewedPresentationModel'] = $dir
.
'includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php';
$wgAutoloadClasses['PageTriageAddMaintenanceTagPresentationModel'] = $dir
diff --git a/api/ApiPageTriageAction.php b/api/ApiPageTriageAction.php
index 1474857..5de3755 100644
--- a/api/ApiPageTriageAction.php
+++ b/api/ApiPageTriageAction.php
@@ -35,7 +35,10 @@
PageTriageUtil::createNotificationEvent(
$article,
$this->getUser(),
- 'pagetriage-mark-as-reviewed'
+ 'pagetriage-mark-as-reviewed',
+ array(
+ 'note' => $params['note'],
+ )
);
}
diff --git a/api/ApiPageTriageTagging.php b/api/ApiPageTriageTagging.php
index 82c9301..1314cfb 100644
--- a/api/ApiPageTriageTagging.php
+++ b/api/ApiPageTriageTagging.php
@@ -96,6 +96,8 @@
$api->execute();
+ $note = $wgContLang->truncate( $params['note'], 150 );
+
// logging to the logging table
if ( $params['taglist'] ) {
if ( $params['deletion'] ) {
@@ -109,7 +111,10 @@
$article,
$this->getUser(),
'pagetriage-add-deletion-tag',
- $params['taglist']
+ array(
+ 'tags' =>
$params['taglist'],
+ 'note' => $note,
+ )
);
} else {
$entry = array(
@@ -119,7 +124,11 @@
$article,
$this->getUser(),
'pagetriage-add-maintenance-tag',
- $params['taglist']
+ array(
+ 'tags' =>
$params['taglist'],
+ 'note' => $note,
+ 'revId' =>
$api->getResult()->getResultData( array( 'edit', 'newrevid' ) ),
+ )
);
}
@@ -127,7 +136,6 @@
$logEntry = new ManualLogEntry( $type,
$action );
$logEntry->setPerformer(
$this->getUser() );
$logEntry->setTarget(
$article->getTitle() );
- $note = $wgContLang->truncate(
$params['note'], 150 );
if ( $note ) {
$logEntry->setComment( $note );
}
diff --git a/i18n/en.json b/i18n/en.json
index 2fcde15..e695841 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -364,9 +364,14 @@
"pagetriage-notification-add-deletion-tag2": "The page [[$2]] was
{{GENDER:$1|reviewed}} and {{GENDER:$1|marked for deletion}} by [[User:$1|$1]].
{{PLURAL:$4|Tag|Tags}}: $3",
"pagetriage-notification-add-deletion-tag-email-subject2": "Your page
was {{GENDER:$1|marked for deletion}} on {{SITENAME}}",
"pagetriage-notification-add-deletion-tag-email-batch-body": "The page
$1 was {{GENDER:$2|marked for deletion}} by $2.",
- "notification-header-pagetriage-mark-as-reviewed": "The page $3 was
{{GENDER:$2|reviewed}} by <b>$1</b>",
- "notification-header-pagetriage-add-maintenance-tag": "The page $3 was
{{GENDER:$2|reviewed}} and {{GENDER:$2|tagged}} by <b>$1</b>.
{{PLURAL:$5|Tag|Tags}}: $4",
- "notification-header-pagetriage-add-deletion-tag": "The page $3 was
{{GENDER:$2|reviewed}} and {{GENDER:$2|marked for deletion}} by <b>$1</b>.
{{PLURAL:$5|Tag|Tags}}: $4",
+ "notification-header-pagetriage-mark-as-reviewed": "The page '''$3'''
has been {{GENDER:$2|reviewed}}.",
+ "notification-header-pagetriage-add-maintenance-tag": "A reviewer
{{GENDER:$2|suggested}} improvements to the page '''$3'''.
{{PLURAL:$5|Tag|Tags}}: $4.",
+ "notification-header-pagetriage-add-deletion-tag": "The page '''$3'''
was {{GENDER:$2|marked for deletion}}. {{PLURAL:$5|Tag|Tags}}: $4.",
+ "notification-body-page-triage-note": "$1",
+ "pagetriage-thank-link": "{{GENDER:$1|{{GENDER:$2|Thank}}}}",
+ "pagetriage-thank-link-title": "Publicly
{{GENDER:$1|{{GENDER:$2|thank}}}} the reviewer",
+ "pagetriage-discuss-link": "{{GENDER:$1|Discuss}}",
+ "pagetriage-discuss-link-title": "{{GENDER:$1|Discuss}}",
"echo-pref-subscription-page-review": "Reviews a page I created",
"echo-pref-tooltip-page-review": "Notify me when someone reviews a page
I created.",
"echo-category-title-page-review": "Page {{PLURAL:$1|review|reviews}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a921e3b..1615bf5 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -379,6 +379,11 @@
"notification-header-pagetriage-mark-as-reviewed": "Flyout-specific
title for 'mark as reviewed' notification. Parameters:\n* $1 is the formatted
user name (the user name, or hidden if deleted user)\n* $2 can be used for
GENDER of user at $1\n* $3 is the title of the page",
"notification-header-pagetriage-add-maintenance-tag": "Flyout-specific
title for 'add maintenance tag' notification. Parameters:\n* $1 is the
formatted user name (the user name, or hidden if deleted user)\n* $2 can be
used for GENDER of user at $1\n* $3 is the title of the page\n* $4 is the list
of maintenance tags\n* $5 is the number of maintenance tags",
"notification-header-pagetriage-add-deletion-tag": "Flyout-specific
title for 'add deletion tag' notification. Parameters:\n* $1 is the formatted
user name (the user name, or hidden if deleted user)\n* $2 can be used for
GENDER of user at $1\n* $3 is the title of the page\n* $4 is the list of
maintenance tags\n* $5 is the number of maintenance tags",
+ "notification-body-page-triage-note": "{{notranslate}}",
+ "pagetriage-thank-link": "Text of the link to thank the reviewer.
\n\nParameters:\n* $1 - The user that is thanking, for gender\n* $2 - The user
that is being thanked, for gender",
+ "pagetriage-thank-link-title": "Tooltip text of the link to thank the
reviewer. \n\nParameters:\n* $1 - The user that is thanking, for gender\n* $2 -
The poster, the user that is being thanked, for gender",
+ "pagetriage-discuss-link": "Text of the link to go to the Articles for
Deletion discussion page. \n\nParameters:\n* $1 - The user receiving the
notification, for gender",
+ "pagetriage-discuss-link-title": "Tooltip text of the link to go to the
Articles for Deletion discussion page. \n\nParameters:\n* $1 - The user
receiving the notification, for gender",
"echo-pref-subscription-page-review": "Option for getting notifications
when someone reviews a page created by the user.\n\nThis is the conclusion of
the sentence begun by the header: {{msg-mw|Prefs-echosubscriptions}}.",
"echo-pref-tooltip-page-review": "This is a short description of the
page-review notification category.\n{{Related|Echo-pref-tooltip}}",
"echo-category-title-page-review": "This is a short title for
notification category.\n\nUsed as <code>$1</code> in
{{msg-mw|Echo-dismiss-message}} and <code>$2</code> in
{{msg-mw|Echo-email-batch-category-header}}.\n\nParameters:\n* $1 - the number
used for plural support\n{{Related|Echo-category-title}}",
diff --git
a/includes/Notifications/PageTriageAddDeletionTagPresentationModel.php
b/includes/Notifications/PageTriageAddDeletionTagPresentationModel.php
index 014231f..e879c3b 100644
--- a/includes/Notifications/PageTriageAddDeletionTagPresentationModel.php
+++ b/includes/Notifications/PageTriageAddDeletionTagPresentationModel.php
@@ -1,13 +1,6 @@
<?php
-class PageTriageAddDeletionTagPresentationModel extends
EchoEventPresentationModel {
- /**
- * {@inheritdoc}
- */
- public function canRender() {
- return $this->event->getTitle() instanceof Title;
- }
-
+class PageTriageAddDeletionTagPresentationModel extends
PageTriagePresentationModel {
/**
* {@inheritdoc}
*/
@@ -18,18 +11,13 @@
/**
* {@inheritdoc}
*/
- public function getPrimaryLink() {
- return array(
- 'url' => $this->event->getTitle()->getFullURL(),
- 'label' => $this->msg(
'notification-link-text-view-page' )->text(),
- );
- }
-
- /**
- * {@inheritdoc}
- */
public function getSecondaryLinks() {
- return array( $this->getAgentLink() );
+ $links = array( $this->getAgentLink() );
+ $discussionLink = $this->getDiscussionLink();
+ if ( $discussionLink ) {
+ $links[] = $discussionLink;
+ }
+ return $links;
}
/**
@@ -46,18 +34,22 @@
return $msg;
}
- /**
- * Returns an array of [tag list, amount of tags], to be used as msg
params.
- *
- * @return array [(string) tag list, (int) amount of tags]
- */
- protected function getTagsForOutput() {
- $eventData = $this->event->getExtra();
-
- if ( !is_array( $eventData ) ) {
- return array( '', 0 );
+ private function getDiscussionLink() {
+ if ( !in_array( 'afd', $this->getTags() ) ) {
+ return false;
}
- return array( $this->language->listToText( $eventData ), count(
$eventData ) );
+ $pageName = $this->event->getTitle()->getText();
+ $discussionPage = Title::newFromText( "Wikipedia:Articles for
deletion/$pageName" );
+ $user = $this->getViewingUserForGender();
+ $labelMsg = $this->msg( 'pagetriage-discuss-link' )->params(
$user );
+ $descMsg = $this->msg( 'pagetriage-discuss-link-title'
)->params( $user );
+ return array(
+ 'label' => $labelMsg->text(),
+ 'url' => $discussionPage->getFullURL(),
+ 'icon' => 'speechBubbles',
+ 'description' => $descMsg->text(),
+ 'prioritized' => true,
+ );
}
}
diff --git
a/includes/Notifications/PageTriageAddMaintenanceTagPresentationModel.php
b/includes/Notifications/PageTriageAddMaintenanceTagPresentationModel.php
index 09b8172..84aaab5 100644
--- a/includes/Notifications/PageTriageAddMaintenanceTagPresentationModel.php
+++ b/includes/Notifications/PageTriageAddMaintenanceTagPresentationModel.php
@@ -1,13 +1,6 @@
<?php
-class PageTriageAddMaintenanceTagPresentationModel extends
EchoEventPresentationModel {
- /**
- * {@inheritdoc}
- */
- public function canRender() {
- return $this->event->getTitle() instanceof Title;
- }
-
+class PageTriageAddMaintenanceTagPresentationModel extends
PageTriagePresentationModel {
/**
* {@inheritdoc}
*/
@@ -18,18 +11,13 @@
/**
* {@inheritdoc}
*/
- public function getPrimaryLink() {
- return array(
- 'url' => $this->event->getTitle()->getFullURL(),
- 'label' => $this->msg(
'notification-link-text-view-page' )->text(),
- );
- }
-
- /**
- * {@inheritdoc}
- */
public function getSecondaryLinks() {
- return array( $this->getAgentLink() );
+ $links = array( $this->getAgentLink() );
+ $thankLink = $this->getThankLink();
+ if ( $thankLink ) {
+ $links[] = $thankLink;
+ }
+ return $links;
}
/**
@@ -46,18 +34,28 @@
return $msg;
}
- /**
- * Returns an array of [tag list, amount of tags], to be used as msg
params.
- *
- * @return array [(string) tag list, (int) amount of tags]
- */
- protected function getTagsForOutput() {
- $eventData = $this->event->getExtra();
-
- if ( !is_array( $eventData ) ) {
- return array( '', 0 );
+ private function getThankLink() {
+ if ( !class_exists( 'ThanksHooks' ) ) {
+ return false;
}
- return array( $this->language->listToText( $eventData ), count(
$eventData ) );
+ $revId = $this->event->getExtraParam( 'revId' );
+ if ( !$revId ) {
+ return false;
+ }
+
+ $thankingUser = $this->getViewingUserForGender();
+ list( , $thankedUser ) = $this->getAgentForOutput();
+ $labelMsg = $this->msg( 'pagetriage-thank-link' );
+ $labelMsg->params( $thankingUser, $thankedUser );
+ $descMsg = $this->msg( 'pagetriage-thank-link-title' );
+ $descMsg->params( $thankingUser, $thankedUser );
+ return array(
+ 'label' => $labelMsg->text(),
+ 'url' => SpecialPage::getTitleFor( 'Thanks', $revId
)->getFullURL(),
+ 'icon' => 'thanks',
+ 'description' => $descMsg->text(),
+ 'prioritized' => true,
+ );
}
}
diff --git
a/includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php
b/includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php
index e72515b..d999019 100644
--- a/includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php
+++ b/includes/Notifications/PageTriageMarkAsReviewedPresentationModel.php
@@ -1,28 +1,12 @@
<?php
-class PageTriageMarkAsReviewedPresentationModel extends
EchoEventPresentationModel {
- /**
- * {@inheritdoc}
- */
- public function canRender() {
- return $this->event->getTitle() instanceof Title;
- }
+class PageTriageMarkAsReviewedPresentationModel extends
PageTriagePresentationModel {
/**
* {@inheritdoc}
*/
public function getIconType() {
return 'reviewed';
- }
-
- /**
- * {@inheritdoc}
- */
- public function getPrimaryLink() {
- return array(
- 'url' => $this->event->getTitle()->getFullURL(),
- 'label' => $this->msg(
'notification-link-text-view-page' )->text(),
- );
}
/**
diff --git a/includes/Notifications/PageTriagePresentationModel.php
b/includes/Notifications/PageTriagePresentationModel.php
new file mode 100644
index 0000000..1130c59
--- /dev/null
+++ b/includes/Notifications/PageTriagePresentationModel.php
@@ -0,0 +1,45 @@
+<?php
+
+abstract class PageTriagePresentationModel extends EchoEventPresentationModel {
+ /**
+ * {@inheritdoc}
+ */
+ public function canRender() {
+ return $this->event->getTitle() instanceof Title;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getPrimaryLink() {
+ return array(
+ 'url' => $this->event->getTitle()->getFullURL(),
+ 'label' => $this->msg(
'notification-link-text-view-page' )->text(),
+ );
+ }
+
+ protected function getTags() {
+ // BC: the extra params array used to be the tags directly, now
the tags are under the key 'tags'
+ return $this->event->getExtraParam( 'tags',
$this->event->getExtra() );
+ }
+
+ /**
+ * Returns an array of [tag list, amount of tags], to be used as msg
params.
+ *
+ * @return array [(string) tag list, (int) amount of tags]
+ */
+ protected function getTagsForOutput() {
+ $tags = $this->getTags();
+
+ if ( !is_array( $tags ) ) {
+ return array( '', 0 );
+ }
+
+ return array( $this->language->commaList( $tags ), count( $tags
) );
+ }
+
+ function getBodyMessage() {
+ $note = $this->event->getExtraParam( 'note' );
+ return $note ? $this->msg( 'notification-body-page-triage-note'
)->params( $note ) : false;
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/268691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6ec612db042c434b5dc14a7e9027f585f2e4057
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/PageTriage
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits