Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14749282
D18627.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D18627.diff
View Options
diff --git a/src/applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php b/src/applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php
--- a/src/applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php
+++ b/src/applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php
@@ -24,7 +24,7 @@
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
- if ($editor->getIsNewObject()) {
+ if ($editor->isFirstBroadcast()) {
return;
}
diff --git a/src/applications/differential/customfield/DifferentialSummaryField.php b/src/applications/differential/customfield/DifferentialSummaryField.php
--- a/src/applications/differential/customfield/DifferentialSummaryField.php
+++ b/src/applications/differential/customfield/DifferentialSummaryField.php
@@ -67,7 +67,7 @@
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
- if (!$editor->getIsNewObject()) {
+ if (!$editor->isFirstBroadcast()) {
return;
}
diff --git a/src/applications/differential/customfield/DifferentialTestPlanField.php b/src/applications/differential/customfield/DifferentialTestPlanField.php
--- a/src/applications/differential/customfield/DifferentialTestPlanField.php
+++ b/src/applications/differential/customfield/DifferentialTestPlanField.php
@@ -71,7 +71,7 @@
PhabricatorApplicationTransactionEditor $editor,
array $xactions) {
- if (!$editor->getIsNewObject()) {
+ if (!$editor->isFirstBroadcast()) {
return;
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -26,6 +26,10 @@
return pht('%s created %s.', $author, $object);
}
+ public function isFirstBroadcast() {
+ return $this->getIsNewObject();
+ }
+
public function getDiffUpdateTransaction(array $xactions) {
$type_update = DifferentialTransaction::TYPE_UPDATE;
@@ -600,24 +604,25 @@
return array_values(array_merge($head, $tail));
}
- protected function requireCapabilities(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- switch ($xaction->getTransactionType()) {}
-
- return parent::requireCapabilities($object, $xaction);
- }
-
protected function shouldPublishFeedStory(
PhabricatorLiskDAO $object,
array $xactions) {
+
+ if (!$object->shouldBroadcast()) {
+ return false;
+ }
+
return true;
}
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {
+
+ if (!$object->shouldBroadcast()) {
+ return false;
+ }
+
return true;
}
@@ -633,14 +638,25 @@
protected function getMailAction(
PhabricatorLiskDAO $object,
array $xactions) {
- $action = parent::getMailAction($object, $xactions);
- $strongest = $this->getStrongestAction($object, $xactions);
- switch ($strongest->getTransactionType()) {
- case DifferentialTransaction::TYPE_UPDATE:
- $count = new PhutilNumber($object->getLineCount());
- $action = pht('%s, %s line(s)', $action, $count);
- break;
+ $show_lines = false;
+ if ($this->isFirstBroadcast()) {
+ $action = pht('Request');
+
+ $show_lines = true;
+ } else {
+ $action = parent::getMailAction($object, $xactions);
+
+ $strongest = $this->getStrongestAction($object, $xactions);
+ $type_update = DifferentialTransaction::TYPE_UPDATE;
+ if ($strongest->getTransactionType() == $type_update) {
+ $show_lines = true;
+ }
+ }
+
+ if ($show_lines) {
+ $count = new PhutilNumber($object->getLineCount());
+ $action = pht('%s, %s line(s)', $action, $count);
}
return $action;
@@ -679,6 +695,16 @@
PhabricatorLiskDAO $object,
array $xactions) {
+ $viewer = $this->requireActor();
+
+ // If this is the first time we're sending mail about this revision, we
+ // generate mail for all prior transactions, not just whatever is being
+ // applied now. This gets the "added reviewers" lines and other relevant
+ // information into the mail.
+ if ($this->isFirstBroadcast()) {
+ $xactions = $this->loadUnbroadcastTransactions($object);
+ }
+
$body = new PhabricatorMetaMTAMailBody();
$body->setViewer($this->requireActor());
@@ -1491,4 +1517,15 @@
$acting_phid);
}
+ private function loadUnbroadcastTransactions($object) {
+ $viewer = $this->requireActor();
+
+ $xactions = id(new DifferentialTransactionQuery())
+ ->setViewer($viewer)
+ ->withObjectPHIDs(array($object->getPHID()))
+ ->execute();
+
+ return array_reverse($xactions);
+ }
+
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -694,6 +694,14 @@
return $this;
}
+ public function shouldBroadcast() {
+ if (!$this->isDraft()) {
+ return true;
+ }
+
+ return false;
+ }
+
/* -( HarbormasterBuildableInterface )------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 11:13 AM (6 h, 53 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7031558
Default Alt Text
D18627.diff (5 KB)
Attached To
Mode
D18627: Prepare revision mail for the "Draft" status
Attached
Detach File
Event Timeline
Log In to Comment