Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/265461
Change subject: [WIP] Engage full surveillance mode for Flow talk pages
......................................................................
[WIP] Engage full surveillance mode for Flow talk pages
WIP because icons are still missing. Rest is done.
Bug: T121663
Change-Id: I63b7489c3a391af16461fe47ca9523256f990f69
---
M i18n/en.json
M i18n/qqq.json
M includes/Notifications/FlowPresentationModel.php
M includes/Notifications/NewTopicPresentationModel.php
M includes/Notifications/Notifications.php
M includes/Notifications/PostEditedPresentationModel.php
M includes/Notifications/PostReplyPresentationModel.php
M includes/Notifications/TopicRenamedPresentationModel.php
8 files changed, 92 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/61/265461/1
diff --git a/i18n/en.json b/i18n/en.json
index f48de9b..f3ed2b2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -272,14 +272,24 @@
"flow-notification-edit-bundle": "$1 and $5 {{PLURAL:$6|other|others}}
{{GENDER:$1|edited}} a <span class=\"plainlinks\">[$4 post]</span> in \"$2\" on
\"$3\".",
"notification-header-flow-new-topic-v2": "New topic created on $3:
\"$4\".",
"notification-bundle-header-flow-new-topic": "$1 new
{{PLURAL:$2|topic|topics}} on $3.",
+ "notification-body-flow-new-topic-v2": "$1",
+ "notification-header-flow-new-topic-user-talk": "A new topic was
created on your talk page: \"$4\"",
+ "notification-bundle-header-flow-new-topic-user-talk": "$1 new
{{PLURAL:$2|topic|topics}} on your talk page.",
+ "notification-body-flow-new-topic-user-talk": "$1",
"notification-header-flow-post-reply": "$1 {{GENDER:$2|replied}} in
\"$4\".",
"notification-bundle-header-flow-post-reply": "$1 new replies in
\"$2\".",
- "notification-body-flow-new-topic-v2": "$1",
"notification-body-flow-post-reply-v2": "$1",
+ "notification-header-flow-post-reply-user-talk": "$1
{{GENDER:$2|posted}} a reply on your talk page in \"$4\".",
+ "notification-bundle-header-flow-post-reply-user-talk": "$1 new replies
on your talk page in \"$2\".",
+ "notification-body-flow-post-reply-user-talk": "$1",
"notification-header-flow-post-edited-v2": "Your post on \"$1\" was
edited.",
"notification-bundle-header-flow-post-edited-v2": "Your post on \"$1\"
was edited multiple times.",
"notification-body-flow-post-edited-v2": "$1",
+ "notification-header-flow-post-edited-user-talk": "A post on \"$1\" was
edited on your talk page.",
+ "notification-bundle-header-flow-post-edited-user-talk": "A post on
\"$1\" was edited multiple times on your talk page.",
+ "notification-body-flow-post-edited-user-talk": "$1",
"notification-header-flow-topic-renamed-v2": "The topic \"$1\" was
renamed to \"$2\".",
+ "notification-header-flow-topic-renamed-user-talk": "The topic \"$1\"
was renamed to \"$2\" on your talk page.",
"notification-header-flow-mention": "$1 {{GENDER:$2|mentioned}}
{{GENDER:$5|you}} in \"$3\".",
"notification-body-flow-mention": "$1",
"notification-header-flow-enabled-on-talkpage": "New discussion system
enabled for {{GENDER:$2|your}} user talk page.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b098e88..2af9e15 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -282,13 +282,23 @@
"notification-header-flow-new-topic-v2": "Notification header text for
when a new topic is created. Parameters:\n$1 - the formatted username of the
user who created the topic\n* $2 - the username for gender purposes\n* $3 -
title of the Flow board\n* $4 - title of the
topic.\n{{Related|Flow-notification}}",
"notification-body-flow-new-topic-v2": "Notification body text for when
a new topic is created. Parameters:\n$1 - a snippet of the content of the new
topic.\n{{Related|Flow-notification}} {{notranslate}}",
"notification-bundle-header-flow-new-topic": "Notification text for
when multiple new topics are created on the same page. Parameters:\n* $1 - The
number of topics that were created for display purposes. This can be a number
or '99+' if it is 99 or more\n* $2 - The number of new topics created for
PLURAL purposes\n* $3 - The title of the page the topics were created
on\n{{Related|Notification-bundle}}",
+ "notification-header-flow-new-topic-user-talk": "Notification header
text for when a new topic is created on a user's talk page. Parameters:\n$1 -
the formatted username of the user who created the topic\n* $2 - the username
for gender purposes\n* $3 - title of the Flow board\n* $4 - title of the
topic.\n{{Related|Flow-notification}}",
+ "notification-body-flow-new-topic-user-talk": "Notification body text
for when a new topic is created on a user's talk page. Parameters:\n$1 - a
snippet of the content of the new topic.\n{{Related|Flow-notification}}
{{notranslate}}",
+ "notification-bundle-header-flow-new-topic-user-talk": "Notification
text for when multiple new topics are created on a user's talk page.
Parameters:\n* $1 - The number of topics that were created for display
purposes. This can be a number or '99+' if it is 99 or more\n* $2 - The number
of new topics created for PLURAL purposes\n* $3 - The title of the page the
topics were created on\n{{Related|Notification-bundle}}",
"notification-header-flow-post-reply": "Notification header text for
when there is a reply on a topic. Parameters:\n$1 - the formatted username of
the user who replied to the topic\n* $2 - the username for gender purposes\n*
$3 - title of the Flow board\n* $4 - title of the
topic.\n{{Related|Flow-notification}}",
"notification-bundle-header-flow-post-reply": "Notification header text
for when there is a multiple replies on a topic. Parameters:\n$1 - the number
of replies for display\n* $2 - title of the
topic.\n{{Related|Flow-notification}}",
"notification-body-flow-post-reply-v2": "Notification body text for
when there is a reply on a topic. Parameters:\n$1 - a snippet of the content of
the reply.\n{{Related|Flow-notification}} {{notranslate}}",
+ "notification-header-flow-post-reply": "Notification header text for
when there is a reply on a topic on a user's talk page. Parameters:\n$1 - the
formatted username of the user who replied to the topic\n* $2 - the username
for gender purposes\n* $3 - title of the Flow board\n* $4 - title of the
topic.\n{{Related|Flow-notification}}",
+ "notification-bundle-header-flow-post-reply": "Notification header text
for when there is a multiple replies on a topic on a user's talk page.
Parameters:\n$1 - the number of replies for display\n* $2 - title of the
topic.\n{{Related|Flow-notification}}",
+ "notification-body-flow-post-reply-v2": "Notification body text for
when there is a reply on a topic on a user's talk page. Parameters:\n$1 - a
snippet of the content of the reply.\n{{Related|Flow-notification}}
{{notranslate}}",
"notification-header-flow-post-edited-v2": "Notification header text
for when a post is edited. Parameters:\n$1 - the formatted username of the user
who edited the post\n* $2 - the username for gender purposes\n* $3 - title of
the Flow board\n* $4 - title of the topic.\n* $5 - username of the person who
receives the notification, can be used for
GENDER.\n{{Related|Flow-notification}}",
"notification-bundle-header-flow-post-edited-v2": "Notification bundle
header text for when a user receives post edits from multiple users on the same
topic.\n\nParameters:\n* $1 - formatted username of the first person who edited
post\n* $2 - username for GENDER\n* $3 - title of the topic\n* $4 - title for
the page that the Flow board is attached to\n* $5 - the count of other action
performers, could be number or {{msg-mw|Echo-notification-count}}. e.g. 7
others or 99+ others\n* $6 - a number used for plural support\n* $7 - username
of the person who receives the notification, can be used for GENDER.\nSee
also:\n*
{{msg-mw|Flow-notification-edit-email-batch-bundle-body}}\n{{Related|Notification-bundle}}",
"notification-body-flow-post-edited-v2": "Notification body text for
when a post is edited. Parameters:\n$1 - the formatted username of the user who
edited the post\n* $2 - the username for gender purposes\n* $3 - title of the
Flow board\n* $4 - title of the topic.\n* $5 - username of the person who
receives the notification, can be used for
GENDER.\n{{Related|Flow-notification}}",
+ "notification-header-flow-post-edited-user-talk": "Notification header
text for when a post is edited on a user's talk page . Parameters:\n$1 - the
formatted username of the user who edited the post\n* $2 - the username for
gender purposes\n* $3 - title of the Flow board\n* $4 - title of the topic.\n*
$5 - username of the person who receives the notification, can be used for
GENDER.\n{{Related|Flow-notification}}",
+ "notification-bundle-header-flow-post-edited-user-talk": "Notification
bundle header text for when a user receives post edits from multiple users on
the same topic on a user's talk page .\n\nParameters:\n* $1 - formatted
username of the first person who edited post\n* $2 - username for GENDER\n* $3
- title of the topic\n* $4 - title for the page that the Flow board is attached
to\n* $5 - the count of other action performers, could be number or
{{msg-mw|Echo-notification-count}}. e.g. 7 others or 99+ others\n* $6 - a
number used for plural support\n* $7 - username of the person who receives the
notification, can be used for GENDER.\nSee also:\n*
{{msg-mw|Flow-notification-edit-email-batch-bundle-body}}\n{{Related|Notification-bundle}}",
+ "notification-body-flow-post-edited-user-talk": "Notification body text
for when a post on a user's talk page is edited. Parameters:\n$1 - the
formatted username of the user who edited the post\n* $2 - the username for
gender purposes\n* $3 - title of the Flow board\n* $4 - title of the topic.\n*
$5 - username of the person who receives the notification, can be used for
GENDER.\n{{Related|Flow-notification}}",
"notification-header-flow-topic-renamed-v2": "Notification header text
for when a topic is renamed. Parameters:\n$1 - the formatted username of the
user who renamed the topic\n* $2 - the username for gender purposes\n* $3 - old
title of the topic\n* $4 - new title of the topic\n* $5 - title of the Flow
board.\n{{Related|Flow-notification}}",
+ "notification-header-flow-topic-renamed-user-talk": "Notification
header text for when a topic is renamed on a user's talk page . Parameters:\n$1
- the formatted username of the user who renamed the topic\n* $2 - the username
for gender purposes\n* $3 - old title of the topic\n* $4 - new title of the
topic\n* $5 - title of the Flow board.\n{{Related|Flow-notification}}",
"notification-header-flow-mention": "{{doc-singularthey}}\nNotification
header text for when a user is mentioned in a post. Parameters:\n* $1 - the
formatted username of the person who made the post\n* $2 - the username for
gender purposes\n* $3 - title of the topic\n* $4 - title of the Flow board\n*
$5 - username of the person who receives the notification, can be used for
GENDER\n{{Related|Flow-notification}}",
"notification-body-flow-mention": "Notification body text for when a
user is mentioned in a post. Parameters:\n* $1 - text snippet of the message
containing the mention\n{{Related|Flow-notification}}",
"notification-header-flow-enabled-on-talkpage": "Notification header
text when Flow is enabled on a user talk page. Parameters:\n* $1 - the
formatted username of the user who enabled Flow on his user talk page\n* $2 -
the username for gender purposes\n* $3 - Title where Flow was enabled.",
diff --git a/includes/Notifications/FlowPresentationModel.php
b/includes/Notifications/FlowPresentationModel.php
index 6aa39f3..926ae8f 100644
--- a/includes/Notifications/FlowPresentationModel.php
+++ b/includes/Notifications/FlowPresentationModel.php
@@ -126,4 +126,9 @@
protected function getTopicTitle() {
return wfEscapeWikiText( $this->event->getExtraParam(
'topic-title' ) );
}
+
+ protected function isUserTalkPage() {
+ $username = $this->getViewingUserForGender();
+ return $this->event->getTitle()->getDBkey() === $username;
+ }
}
diff --git a/includes/Notifications/NewTopicPresentationModel.php
b/includes/Notifications/NewTopicPresentationModel.php
index 1c89f56..515857f 100644
--- a/includes/Notifications/NewTopicPresentationModel.php
+++ b/includes/Notifications/NewTopicPresentationModel.php
@@ -35,14 +35,21 @@
public function getBodyMessage() {
if ( $this->isBundled() ) {
return false;
+ } elseif ( $this->isUserTalkPage() ) {
+ $msg = $this->msg(
"notification-body-{$this->type}-user-talk" );
} else {
$msg = $this->msg( "notification-body-{$this->type}-v2"
);
- $msg->params( $this->getContentSnippet() );
- return $msg;
}
+
+ $msg->params( $this->getContentSnippet() );
+ return $msg;
}
protected function getHeaderMessageKey() {
+ if ( $this->isUserTalkPage() ) {
+ return parent::getHeaderMessageKey() . '-user-talk';
+ }
+
return parent::getHeaderMessageKey() . '-v2';
}
diff --git a/includes/Notifications/Notifications.php
b/includes/Notifications/Notifications.php
index 4775d65..cf7e446 100644
--- a/includes/Notifications/Notifications.php
+++ b/includes/Notifications/Notifications.php
@@ -41,6 +41,7 @@
'presentation-model' => 'Flow\\PostReplyPresentationModel',
'user-locators' => array(
'Flow\\NotificationsUserLocator::locateUsersWatchingTopic',
+ 'EchoUserLocator::locateTalkPageOwner'
),
'primary-link' => array(
'message' => 'flow-notification-link-text-view-post',
@@ -66,6 +67,7 @@
'presentation-model' => 'Flow\\PostEditedPresentationModel',
'user-locators' => array(
'Flow\\NotificationsUserLocator::locatePostAuthors',
+ 'EchoUserLocator::locateTalkPageOwner'
),
'primary-link' => array(
'message' => 'flow-notification-link-text-view-post',
@@ -91,6 +93,7 @@
'presentation-model' => 'Flow\\TopicRenamedPresentationModel',
'user-locators' => array(
'Flow\\NotificationsUserLocator::locateTopicAuthors',
+ 'EchoUserLocator::locateTalkPageOwner'
),
'primary-link' => array(
'message' => 'flow-notification-link-text-view-post',
diff --git a/includes/Notifications/PostEditedPresentationModel.php
b/includes/Notifications/PostEditedPresentationModel.php
index 6cc053a..07725aa 100644
--- a/includes/Notifications/PostEditedPresentationModel.php
+++ b/includes/Notifications/PostEditedPresentationModel.php
@@ -30,18 +30,34 @@
}
protected function getHeaderMessageKey() {
- return parent::getHeaderMessageKey() . '-v2';
+ if ( $this->isBundled() ) {
+ if ( $this->isUserTalkPage() ) {
+ return
"notification-bundle-header-{$this->type}-user-talk";
+ } else {
+ return
"notification-bundle-header-{$this->type}-v2";
+ }
+ } else {
+ if ( $this->isUserTalkPage() ) {
+ return parent::getHeaderMessageKey() .
'-user-talk';
+ } else {
+ return parent::getHeaderMessageKey() . '-v2';
+ }
+ }
}
public function getHeaderMessage() {
- $key = $this->isBundled() ?
"notification-bundle-header-{$this->type}-v2" : $this->getHeaderMessageKey();
- $msg = $this->msg( $key );
+ $msg = $this->msg( $this->getHeaderMessageKey() );
$msg->params( $this->getTopicTitle() );
return $msg;
}
public function getBodyMessage() {
- $msg = $this->msg( "notification-body-{$this->type}-v2" );
+ if ( $this->isUserTalkPage() ) {
+ $msg = $this->msg(
"notification-body-{$this->type}-user-talk" );
+ } else {
+ $msg = $this->msg( "notification-body-{$this->type}-v2"
);
+ }
+
$msg->params( $this->getContentSnippet() );
return $msg;
}
diff --git a/includes/Notifications/PostReplyPresentationModel.php
b/includes/Notifications/PostReplyPresentationModel.php
index 5f7e28f..6a7c484 100644
--- a/includes/Notifications/PostReplyPresentationModel.php
+++ b/includes/Notifications/PostReplyPresentationModel.php
@@ -16,7 +16,13 @@
}
public function getPrimaryLink() {
- $event = $this->isBundled() ? end( $this->getBundledEvents() )
: $this->event;
+ if ( $this->isBundled() ) {
+ // "Strict standards: Only variables should be passed
by reference" in older PHP versions
+ $bundledEvents = $this->getBundledEvents();
+ $event = end( $bundledEvents );
+ } else {
+ $event = $this->event;
+ }
$postId = $event->getExtraParam( 'post-id' );
return array(
'url' => $this->getPostLinkUrl( $postId ),
@@ -32,10 +38,26 @@
}
}
+ protected function getHeaderMessageKey() {
+ if ( $this->isBundled() ) {
+ if ( $this->isUserTalkPage() ) {
+ return
"notification-bundle-header-{$this->type}-user-talk";
+ } else {
+ return
"notification-bundle-header-{$this->type}";
+ }
+ } else {
+ if ( $this->isUserTalkPage() ) {
+ return parent::getHeaderMessageKey() .
"-user-talk";
+ } else {
+ return parent::getHeaderMessageKey();
+ }
+ }
+ }
+
public function getHeaderMessage() {
if ( $this->isBundled() ) {
list( $formattedCount, $countForPlural ) =
$this->getNotificationCountForOutput();
- $msg = $this->msg(
"notification-bundle-header-{$this->type}" );
+ $msg = $this->msg( $this->getHeaderMessageKey() );
$msg->params( $formattedCount, $this->getTopicTitle() );
return $msg;
} else {
@@ -48,7 +70,11 @@
public function getBodyMessage() {
if ( !$this->isBundled() ) {
- $msg = $this->msg( "notification-body-{$this->type}-v2"
);
+ if ( $this->isUserTalkPage() ) {
+ $msg =
$this->msg("notification-body-{$this->type}-v2");
+ } else {
+ $msg =
$this->msg("notification-body-{$this->type}-user-talk");
+ }
$msg->params( $this->getContentSnippet() );
return $msg;
}
diff --git a/includes/Notifications/TopicRenamedPresentationModel.php
b/includes/Notifications/TopicRenamedPresentationModel.php
index 5443c21..9d65217 100644
--- a/includes/Notifications/TopicRenamedPresentationModel.php
+++ b/includes/Notifications/TopicRenamedPresentationModel.php
@@ -26,7 +26,11 @@
}
protected function getHeaderMessageKey() {
- return parent::getHeaderMessageKey() . '-v2';
+ if ( $this->isUserTalkPage() ) {
+ return parent::getHeaderMessageKey() . '-user-talk';
+ } else {
+ return parent::getHeaderMessageKey() . '-v2';
+ }
}
public function getHeaderMessage() {
--
To view, visit https://gerrit.wikimedia.org/r/265461
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63b7489c3a391af16461fe47ca9523256f990f69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits