Page MenuHomePhabricator

D12823.id31872.diff
No OneTemporary

D12823.id31872.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
@@ -62,6 +62,7 @@
$types[] = DifferentialTransaction::TYPE_INLINE;
$types[] = DifferentialTransaction::TYPE_STATUS;
$types[] = DifferentialTransaction::TYPE_UPDATE;
+ $types[] = DifferentialTransaction::TYPE_UNBLOCK;
return $types;
}
@@ -81,6 +82,8 @@
} else {
return $object->getActiveDiff()->getPHID();
}
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return null;
}
return parent::getCustomTransactionOldValue($object, $xaction);
@@ -93,6 +96,7 @@
switch ($xaction->getTransactionType()) {
case DifferentialTransaction::TYPE_ACTION:
case DifferentialTransaction::TYPE_UPDATE:
+ case DifferentialTransaction::TYPE_UNBLOCK:
return $xaction->getNewValue();
case DifferentialTransaction::TYPE_INLINE:
return null;
@@ -244,6 +248,9 @@
$xaction->getNewValue()));
}
break;
+
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return;
}
return parent::applyCustomInternalTransaction($object, $xaction);
@@ -588,6 +595,8 @@
$diff->setRevisionID($object->getID());
$diff->save();
return;
+ case DifferentialTransaction::TYPE_UNBLOCK:
+ return;
}
return parent::applyCustomExternalTransaction($object, $xaction);
@@ -758,6 +767,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;
}
@@ -1262,6 +1320,8 @@
pht('A revision is created.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED =>
pht('A revision is updated.'),
+ MetaMTANotificationType::TYPE_DIFFERENTIAL_UNBLOCKED =>
+ 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';
@@ -35,6 +36,15 @@
return new DifferentialTransactionView();
}
+ public function shouldGenerateOldValue() {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_UNBLOCK:
+ return false;
+ }
+
+ return parent::shouldGenerateOldValue();
+ }
+
public function shouldHide() {
$old = $this->getOldValue();
$new = $this->getNewValue();
@@ -103,13 +113,17 @@
$phids[] = $new;
}
break;
+ case self::TYPE_UNBLOCK:
+ foreach (array_keys($new) as $phid) {
+ $phids[] = $phid;
+ }
+ break;
}
return $phids;
}
public function getActionStrength() {
-
switch ($this->getTransactionType()) {
case self::TYPE_ACTION:
return 3;
@@ -188,6 +202,9 @@
case self::TYPE_INLINE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT;
break;
+ case self::TYPE_UNBLOCK:
+ $tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_UNBLOCKED;
+ break;
}
if (!$tags) {
@@ -280,6 +297,13 @@
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
return pht('This revision now requires review to proceed.');
}
+ case self::TYPE_UNBLOCK:
+ $blocker_phid = head_key($new);
+
+ return pht(
+ '%s closed blocking revision %s.',
+ $author_handle,
+ $this->renderHandleLink($blocker_phid));
}
return parent::getTitle();
@@ -438,6 +462,14 @@
'%s now requires review to proceed.',
$object_link);
}
+ case self::TYPE_UNBLOCK:
+ $blocker_phid = head_key($new);
+
+ return pht(
+ '%s closed %s, a revision blocking %s.',
+ $author_link,
+ $this->renderHandleLink($blocker_phid),
+ $object_link);
}
return parent::getTitleForFeed();
@@ -481,6 +513,8 @@
case DifferentialAction::ACTION_CLAIM:
return 'fa-flag';
}
+ case self::TYPE_UNBLOCK:
+ return 'fa-shield';
case PhabricatorTransactions::TYPE_EDGE:
switch ($this->getMetadataValue('edge:type')) {
case DifferentialRevisionHasReviewerEdgeType::EDGECONST:
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

Mime Type
text/plain
Expires
Dec 11 2025, 9:43 PM (5 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
14183871
Default Alt Text
D12823.id31872.diff (7 KB)

Event Timeline