Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19071676
D12823.id30822.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D12823.id30822.diff
View Options
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
@@ -62,6 +62,7 @@
$types[] = DifferentialTransaction::TYPE_INLINE;
$types[] = DifferentialTransaction::TYPE_STATUS;
$types[] = DifferentialTransaction::TYPE_UPDATE;
+ $types[] = DifferentialTransaction::TYPE_UNBLOCK;
return $types;
}
@@ -85,6 +86,8 @@
} else {
return $object->getActiveDiff()->getPHID();
}
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return null;
}
return parent::getCustomTransactionOldValue($object, $xaction);
@@ -99,6 +102,7 @@
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case DifferentialTransaction::TYPE_ACTION:
case DifferentialTransaction::TYPE_UPDATE:
+ case DifferentialTransaction::TYPE_UNBLOCK:
return $xaction->getNewValue();
case DifferentialTransaction::TYPE_INLINE:
return null;
@@ -261,6 +265,9 @@
$xaction->getNewValue()));
}
break;
+
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return;
}
return parent::applyCustomInternalTransaction($object, $xaction);
@@ -611,6 +618,8 @@
$diff->setRevisionID($object->getID());
$diff->save();
return;
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return;
}
return parent::applyCustomExternalTransaction($object, $xaction);
@@ -781,6 +790,55 @@
break;
}
+ // When we change the status of a diff, update diffs this diff blocks
+ // with a message to the effect of "alincoln closed blocking diff Dxxx."
+ $unblock_xaction = null;
+ foreach ($xactions as $xaction) {
+ switch ($xaction->getTransactionType()) {
+ case DifferentialTransaction::TYPE_ACTION:
+ switch ($xaction->getNewValue()) {
+ case DifferentialAction::ACTION_CLOSE:
+ $unblock_xaction = $xaction;
+ break;
+ }
+ break;
+ }
+ }
+
+ if ($unblock_xaction !== null) {
+ $blocked_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $object->getPHID(),
+ DifferentialRevisionDependedOnByRevisionEdgeType::EDGECONST);
+ if ($blocked_phids) {
+ // In theory we could apply these through policies, but that seems a
+ // little bit surprising. For now, use the actor's vision.
+ $blocked_revisions = id(new DifferentialRevisionQuery())
+ ->setViewer($this->getActor())
+ ->withPHIDs($blocked_phids)
+ ->execute();
+
+ $old = $unblock_xaction->getOldValue();
+ $new = $unblock_xaction->getNewValue();
+
+ foreach ($blocked_revisions as $blocked_revision) {
+ $unblock_xactions = array();
+
+ $unblock_xactions[] = id(new DifferentialTransaction())
+ ->setTransactionType(DifferentialTransaction::TYPE_UNBLOCK)
+ ->setOldValue(array($object->getPHID() => $old))
+ ->setNewValue(array($object->getPHID() => $new));
+
+ id(new DifferentialTransactionEditor())
+ ->setActor($this->getActor())
+ ->setActingAsPHID($this->getActingAsPHID())
+ ->setContentSource($this->getContentSource())
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true)
+ ->applyTransactions($blocked_revision, $unblock_xactions);
+ }
+ }
+ }
+
return $xactions;
}
@@ -1286,6 +1344,8 @@
pht('A revision is created.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED =>
pht('A revision is updated.'),
+ MetaMTANotificationType::MAILTAG_UNBLOCK =>
+ pht('One of the revisions a revision is blocked by is closed.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT =>
pht('Someone comments on a revision.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED =>
diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php
--- a/src/applications/differential/storage/DifferentialTransaction.php
+++ b/src/applications/differential/storage/DifferentialTransaction.php
@@ -14,10 +14,11 @@
return $this->isCommandeerSideEffect;
}
- const TYPE_INLINE = 'differential:inline';
- const TYPE_UPDATE = 'differential:update';
- const TYPE_ACTION = 'differential:action';
- const TYPE_STATUS = 'differential:status';
+ const TYPE_INLINE = 'differential:inline';
+ const TYPE_UPDATE = 'differential:update';
+ const TYPE_ACTION = 'differential:action';
+ const TYPE_STATUS = 'differential:status';
+ const TYPE_UNBLOCK = 'differential:unblock';
public function getApplicationName() {
return 'differential';
@@ -109,7 +110,6 @@
}
public function getActionStrength() {
-
switch ($this->getTransactionType()) {
case self::TYPE_ACTION:
return 3;
@@ -283,6 +283,8 @@
return pht(
'This revision now requires review to proceed.');
}
+ case self::TYPE_UNBLOCK:
+ return pht('Closed blocking revision.');
}
return parent::getTitle();
diff --git a/src/applications/metamta/constants/MetaMTANotificationType.php b/src/applications/metamta/constants/MetaMTANotificationType.php
--- a/src/applications/metamta/constants/MetaMTANotificationType.php
+++ b/src/applications/metamta/constants/MetaMTANotificationType.php
@@ -7,6 +7,7 @@
const TYPE_DIFFERENTIAL_CLOSED = 'differential-committed';
const TYPE_DIFFERENTIAL_CC = 'differential-cc';
const TYPE_DIFFERENTIAL_COMMENT = 'differential-comment';
+ const TYPE_DIFFERENTIAL_UNBLOCKED = 'differential-unblocked';
const TYPE_DIFFERENTIAL_UPDATED = 'differential-updated';
const TYPE_DIFFERENTIAL_REVIEW_REQUEST = 'differential-review-request';
const TYPE_DIFFERENTIAL_OTHER = 'differential-other';
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 1 2025, 8:10 PM (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
13854647
Default Alt Text
D12823.id30822.diff (6 KB)
Attached To
Mode
D12823: Trigger notifications when a dependent differential is closed
Attached
Detach File
Event Timeline
Log In to Comment