Skip to content

Commit ba37594

Browse files
committed
Add support for more granular sending of email in application transactions
Summary: Deploy on paste and macro for create stories, 'cuz those are boring emails. Fixes T3808. Test Plan: made a paste and a macro. commented on 'em. verified i got mail on comments only. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3808 Differential Revision: https://secure.phabricator.com/D6988
1 parent a26d3cc commit ba37594

File tree

9 files changed

+44
-10
lines changed

9 files changed

+44
-10
lines changed

src/applications/conpherence/editor/ConpherenceEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ protected function mergeTransactions(
322322
return parent::mergeTransactions($u, $v);
323323
}
324324

325-
protected function supportsMail() {
325+
protected function shouldSendMail(
326+
PhabricatorLiskDAO $object,
327+
array $xactions) {
326328
return true;
327329
}
328330

src/applications/files/editor/PhabricatorFileEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ protected function applyCustomExternalTransaction(
3636
PhabricatorApplicationTransaction $xaction) {
3737
}
3838

39-
protected function supportsMail() {
39+
protected function shouldSendMail(
40+
PhabricatorLiskDAO $object,
41+
array $xactions) {
4042
return true;
4143
}
4244

src/applications/legalpad/editor/LegalpadDocumentEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ protected function mergeTransactions(
122122

123123
/* -( Sending Mail )------------------------------------------------------- */
124124

125-
protected function supportsMail() {
125+
protected function shouldSendMail(
126+
PhabricatorLiskDAO $object,
127+
array $xactions) {
126128
return true;
127129
}
128130

src/applications/macro/editor/PhabricatorMacroEditor.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ protected function mergeTransactions(
7878
return parent::mergeTransactions($u, $v);
7979
}
8080

81-
protected function supportsMail() {
81+
protected function shouldSendMail(
82+
PhabricatorLiskDAO $object,
83+
array $xactions) {
84+
foreach ($xactions as $xaction) {
85+
switch ($xaction->getTransactionType()) {
86+
case PhabricatorMacroTransactionType::TYPE_NAME;
87+
return ($xaction->getOldValue() !== null);
88+
default:
89+
break;
90+
}
91+
}
8292
return true;
8393
}
8494

src/applications/paste/editor/PhabricatorPasteEditor.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,17 @@ protected function applyInitialEffects(
100100
}
101101
}
102102

103-
protected function supportsMail() {
103+
protected function shouldSendMail(
104+
PhabricatorLiskDAO $object,
105+
array $xactions) {
106+
foreach ($xactions as $xaction) {
107+
switch ($xaction->getTransactionType()) {
108+
case PhabricatorPasteTransaction::TYPE_CREATE:
109+
return false;
110+
default:
111+
break;
112+
}
113+
}
104114
return true;
105115
}
106116

src/applications/pholio/editor/PholioMockEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ protected function mergeTransactions(
288288
return parent::mergeTransactions($u, $v);
289289
}
290290

291-
protected function supportsMail() {
291+
protected function shouldSendMail(
292+
PhabricatorLiskDAO $object,
293+
array $xactions) {
292294
return true;
293295
}
294296

src/applications/ponder/editor/PonderQuestionEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ protected function shouldImplyCC(
165165
return parent::shouldImplyCC($object, $xaction);
166166
}
167167

168-
protected function supportsMail() {
168+
protected function shouldSendMail(
169+
PhabricatorLiskDAO $object,
170+
array $xactions) {
169171
return true;
170172
}
171173

src/applications/releeph/editor/ReleephRequestTransactionalEditor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ protected function filterTransactions(
155155
return parent::filterTransactions($object, $xactions);
156156
}
157157

158-
protected function supportsMail() {
158+
protected function shouldSendMail(
159+
PhabricatorLiskDAO $object,
160+
array $xactions) {
159161
return true;
160162
}
161163

src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ final public function applyTransactions(
457457
$this->loadHandles($xactions);
458458

459459
$mail = null;
460-
if ($this->supportsMail()) {
460+
if ($this->shouldSendMail($object, $xactions)) {
461461
$mail = $this->sendMail($object, $xactions);
462462
}
463463

@@ -1069,7 +1069,9 @@ protected function shouldImplyCC(
10691069
/**
10701070
* @task mail
10711071
*/
1072-
protected function supportsMail() {
1072+
protected function shouldSendMail(
1073+
PhabricatorLiskDAO $object,
1074+
array $xactions) {
10731075
return false;
10741076
}
10751077

0 commit comments

Comments
 (0)