Page MenuHomePhabricator

D18801.diff
No OneTemporary

D18801.diff

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
@@ -10,6 +10,7 @@
private $hasReviewTransaction = false;
private $affectedPaths;
private $firstBroadcast = false;
+ private $wasDraft = false;
public function getEditorApplicationClass() {
return 'PhabricatorDifferentialApplication';
@@ -166,6 +167,8 @@
}
}
+ $this->wasDraft = $object->isDraft();
+
return parent::expandTransactions($object, $xactions);
}
@@ -1581,10 +1584,6 @@
$this->setActingAsPHID($author_phid);
}
- // Mark this as the first broadcast we're sending about the revision
- // so mail can generate specially.
- $this->firstBroadcast = true;
-
$xaction = $object->getApplicationTransactionTemplate()
->setAuthorPHID($author_phid)
->setTransactionType(
@@ -1612,12 +1611,31 @@
$xactions[] = $xaction;
}
- } else {
- // If this revision is being created into some state other than "Draft",
- // this is the first broadcast and should include sections like "SUMMARY"
- // and "TEST PLAN".
- if ($this->getIsNewObject()) {
+ }
+
+ // If the revision is new or was a draft, and is no longer a draft, we
+ // might be sending the first email about it.
+
+ // This might mean it was created directly into a non-draft state, or
+ // it just automatically undrafted after builds finished, or a user
+ // explicitly promoted it out of the draft state with an action like
+ // "Request Review".
+
+ // If we haven't sent any email about it yet, mark this email as the first
+ // email so the mail gets enriched with "SUMMARY" and "TEST PLAN".
+
+ $is_new = $this->getIsNewObject();
+ $was_draft = $this->wasDraft;
+
+ if (!$object->isDraft() && ($was_draft || $is_new)) {
+ if (!$object->getHasBroadcast()) {
+ // Mark this as the first broadcast we're sending about the revision
+ // so mail can generate specially.
$this->firstBroadcast = true;
+
+ $object
+ ->setHasBroadcast(true)
+ ->save();
}
}
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
@@ -60,6 +60,7 @@
const PROPERTY_CLOSED_FROM_ACCEPTED = 'wasAcceptedBeforeClose';
const PROPERTY_DRAFT_HOLD = 'draft.hold';
+ const PROPERTY_HAS_BROADCAST = 'draft.broadcast';
public static function initializeNewRevision(PhabricatorUser $actor) {
$app = id(new PhabricatorApplicationQuery())
@@ -719,6 +720,15 @@
return $this->setProperty(self::PROPERTY_DRAFT_HOLD, $hold);
}
+ public function getHasBroadcast() {
+ return $this->getProperty(self::PROPERTY_HAS_BROADCAST, false);
+ }
+
+ public function setHasBroadcast($has_broadcast) {
+ return $this->setProperty(self::PROPERTY_HAS_BROADCAST, $has_broadcast);
+ }
+
+
public function loadActiveBuilds(PhabricatorUser $viewer) {
$diff = $this->getActiveDiff();

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 8, 10:46 AM (2 w, 16 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7381923
Default Alt Text
D18801.diff (3 KB)

Event Timeline