Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15404793
D21049.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D21049.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4921,6 +4921,7 @@
'PhabricatorSubscriptionsListController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsListController.php',
'PhabricatorSubscriptionsMailEngineExtension' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsMailEngineExtension.php',
'PhabricatorSubscriptionsMuteController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsMuteController.php',
+ 'PhabricatorSubscriptionsMuteEmailCommand' => 'applications/subscriptions/command/PhabricatorSubscriptionsMuteEmailCommand.php',
'PhabricatorSubscriptionsRemoveSelfHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsRemoveSelfHeraldAction.php',
'PhabricatorSubscriptionsRemoveSubscribersHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsRemoveSubscribersHeraldAction.php',
'PhabricatorSubscriptionsSearchEngineAttachment' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsSearchEngineAttachment.php',
@@ -11707,6 +11708,7 @@
'PhabricatorSubscriptionsListController' => 'PhabricatorController',
'PhabricatorSubscriptionsMailEngineExtension' => 'PhabricatorMailEngineExtension',
'PhabricatorSubscriptionsMuteController' => 'PhabricatorController',
+ 'PhabricatorSubscriptionsMuteEmailCommand' => 'MetaMTAEmailTransactionCommand',
'PhabricatorSubscriptionsRemoveSelfHeraldAction' => 'PhabricatorSubscriptionsHeraldAction',
'PhabricatorSubscriptionsRemoveSubscribersHeraldAction' => 'PhabricatorSubscriptionsHeraldAction',
'PhabricatorSubscriptionsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
diff --git a/src/applications/subscriptions/command/PhabricatorSubscriptionsMuteEmailCommand.php b/src/applications/subscriptions/command/PhabricatorSubscriptionsMuteEmailCommand.php
new file mode 100644
--- /dev/null
+++ b/src/applications/subscriptions/command/PhabricatorSubscriptionsMuteEmailCommand.php
@@ -0,0 +1,49 @@
+<?php
+
+final class PhabricatorSubscriptionsMuteEmailCommand
+ extends MetaMTAEmailTransactionCommand {
+
+ public function getCommand() {
+ return 'mute';
+ }
+
+ public function getCommandSummary() {
+ return pht('Mute notifications from this object.');
+ }
+
+ public function isCommandSupportedForObject(
+ PhabricatorApplicationTransactionInterface $object) {
+ return ($object instanceof PhabricatorSubscribableInterface);
+ }
+
+ public function buildTransactions(
+ PhabricatorUser $viewer,
+ PhabricatorApplicationTransactionInterface $object,
+ PhabricatorMetaMTAReceivedMail $mail,
+ $command,
+ array $argv) {
+ $xactions = array();
+
+ $muted_type = PhabricatorMutedByEdgeType::EDGECONST;
+
+ $xactions[] = id($object->getApplicationTransactionTemplate())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $muted_type)
+ ->setNewValue(
+ array(
+ '+' => array_fuse(array($viewer->getPHID())),
+ ));
+
+ // we need to immediatelly unsubscribe because otherwise subscription
+ // will be added by ReplyHandler
+ $xactions[] = $object->getApplicationTransactionTemplate()
+ ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
+ ->setNewValue(
+ array(
+ '-' => array($viewer->getPHID()),
+ ));
+
+ return $xactions;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 9:07 AM (4 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7336289
Default Alt Text
D21049.diff (3 KB)
Attached To
Mode
D21049: Add Email command to mute notifications for object
Attached
Detach File
Event Timeline
Log In to Comment