From 8965c7ec9b8935f453fce5ecd9ecb6bcceeb6fad Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 16 Jun 2015 14:25:13 -0700 Subject: [PATCH] Email Preferences - round out options for Projects and Phriction Summary: Fixes T8524, T8550. These were both missing "subscribers" and Phriction was also the only application with no "other". Test Plan: - Project - set user A to notify only for project subscriber changes - made a project with user A - subscribed user B to project - verified notification sent to user A - used ./bin/mail to make sure no mail was sent to user A because "This mail has tags which control which users receive it, and this recipient has not elected to receive mail with any of the tags on this message (Settings > Email Preferences)." - Phriction - set user A to notify only for phriction document subscriber changes - made a document with user A - subscribed user B to document - verified notification sent to user A - used ./bin/mail to make sure no mail was sent to user A because "This mail has tags which control which users receive it, and this recipient has not elected to receive mail with any of the tags on this message (Settings > Email Preferences)." - observed option for "other" in email preferences Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8524, T8550 Differential Revision: https://secure.phabricator.com/D13313 --- .../editor/PhrictionTransactionEditor.php | 4 ++++ .../phriction/storage/PhrictionTransaction.php | 15 +++++++++++---- .../PhabricatorProjectTransactionEditor.php | 2 ++ .../storage/PhabricatorProjectTransaction.php | 12 ++++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index b276aaf34a..5d1534df19 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -391,6 +391,10 @@ final class PhrictionTransactionEditor pht("A document's content changes."), PhrictionTransaction::MAILTAG_DELETE => pht('A document is deleted.'), + PhrictionTransaction::MAILTAG_SUBSCRIBERS => + pht('A document\'s subscribers change.'), + PhrictionTransaction::MAILTAG_OTHER => + pht('Other document activity not listed above occurs.'), ); } diff --git a/src/applications/phriction/storage/PhrictionTransaction.php b/src/applications/phriction/storage/PhrictionTransaction.php index 069e147017..a3ae6adb9d 100644 --- a/src/applications/phriction/storage/PhrictionTransaction.php +++ b/src/applications/phriction/storage/PhrictionTransaction.php @@ -9,9 +9,11 @@ final class PhrictionTransaction const TYPE_MOVE_TO = 'move-to'; const TYPE_MOVE_AWAY = 'move-away'; - const MAILTAG_TITLE = 'phriction-title'; - const MAILTAG_CONTENT = 'phriction-content'; - const MAILTAG_DELETE = 'phriction-delete'; + const MAILTAG_TITLE = 'phriction-title'; + const MAILTAG_CONTENT = 'phriction-content'; + const MAILTAG_DELETE = 'phriction-delete'; + const MAILTAG_SUBSCRIBERS = 'phriction-subscribers'; + const MAILTAG_OTHER = 'phriction-other'; public function getApplicationName() { return 'phriction'; @@ -280,7 +282,12 @@ final class PhrictionTransaction case self::TYPE_DELETE: $tags[] = self::MAILTAG_DELETE; break; - + case PhabricatorTransactions::TYPE_SUBSCRIBERS: + $tags[] = self::MAILTAG_SUBSCRIBERS; + break; + default: + $tags[] = self::MAILTAG_OTHER; + break; } return $tags; } diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 4193c2e4c4..c5253da956 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -433,6 +433,8 @@ final class PhabricatorProjectTransactionEditor pht('Project membership changes.'), PhabricatorProjectTransaction::MAILTAG_WATCHERS => pht('Project watcher list changes.'), + PhabricatorProjectTransaction::MAILTAG_SUBSCRIBERS => + pht('Project subscribers change.'), PhabricatorProjectTransaction::MAILTAG_OTHER => pht('Other project activity not listed above occurs.'), ); diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php index c8698dbe6b..01a458dee2 100644 --- a/src/applications/project/storage/PhabricatorProjectTransaction.php +++ b/src/applications/project/storage/PhabricatorProjectTransaction.php @@ -14,10 +14,11 @@ final class PhabricatorProjectTransaction // NOTE: This is deprecated, members are just a normal edge now. const TYPE_MEMBERS = 'project:members'; - const MAILTAG_METADATA = 'project-metadata'; - const MAILTAG_MEMBERS = 'project-members'; - const MAILTAG_WATCHERS = 'project-watchers'; - const MAILTAG_OTHER = 'project-other'; + const MAILTAG_METADATA = 'project-metadata'; + const MAILTAG_MEMBERS = 'project-members'; + const MAILTAG_SUBSCRIBERS = 'project-subscribers'; + const MAILTAG_WATCHERS = 'project-watchers'; + const MAILTAG_OTHER = 'project-other'; public function getApplicationName() { return 'project'; @@ -369,6 +370,9 @@ final class PhabricatorProjectTransaction case self::TYPE_COLOR: $tags[] = self::MAILTAG_METADATA; break; + case PhabricatorTransactions::TYPE_SUBSCRIBERS: + $tags[] = self::MAILTAG_SUBSCRIBERS; + break; case PhabricatorTransactions::TYPE_EDGE: $type = $this->getMetadata('edge:type'); $type = head($type);