Page MenuHomePhabricator

D11230.diff
No OneTemporary

D11230.diff

diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php
--- a/src/applications/maniphest/storage/ManiphestTransaction.php
+++ b/src/applications/maniphest/storage/ManiphestTransaction.php
@@ -114,6 +114,12 @@
$phids[] = $phid;
}
break;
+ case self::TYPE_STATUS:
+ $commit_phid = $this->getMetadataValue('commitPHID');
+ if ($commit_phid) {
+ $phids[] = $commit_phid;
+ }
+ break;
}
return $phids;
@@ -121,6 +127,16 @@
public function shouldHide() {
switch ($this->getTransactionType()) {
+ case PhabricatorTransactions::TYPE_EDGE:
+ $commit_phid = $this->getMetadataValue('commitPHID');
+ $edge_type = $this->getMetadataValue('edge:type');
+
+ if ($edge_type == ManiphestTaskHasCommitEdgeType::EDGECONST) {
+ if ($commit_phid) {
+ return true;
+ }
+ }
+ break;
case self::TYPE_DESCRIPTION:
case self::TYPE_PRIORITY:
case self::TYPE_STATUS:
@@ -385,28 +401,62 @@
$old_name = ManiphestTaskStatus::getTaskStatusName($old);
$new_name = ManiphestTaskStatus::getTaskStatusName($new);
+ $commit_phid = $this->getMetadataValue('commitPHID');
+
if ($new_closed && !$old_closed) {
if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
+ if ($commit_phid) {
+ return pht(
+ '%s closed this task as a duplicate by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s closed this task as a duplicate.',
+ $this->renderHandleLink($author_phid));
+ }
+ } else {
+ if ($commit_phid) {
+ return pht(
+ '%s closed this task as "%s" by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $new_name,
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s closed this task as "%s".',
+ $this->renderHandleLink($author_phid),
+ $new_name);
+ }
+ }
+ } else if (!$new_closed && $old_closed) {
+ if ($commit_phid) {
return pht(
- '%s closed this task as a duplicate.',
- $this->renderHandleLink($author_phid));
+ '%s reopened this task as "%s" by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $new_name,
+ $this->renderHandleLink($commit_phid));
} else {
return pht(
- '%s closed this task as "%s".',
+ '%s reopened this task as "%s".',
$this->renderHandleLink($author_phid),
$new_name);
}
- } else if (!$new_closed && $old_closed) {
- return pht(
- '%s reopened this task as "%s".',
- $this->renderHandleLink($author_phid),
- $new_name);
} else {
- return pht(
- '%s changed the task status from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $old_name,
- $new_name);
+ if ($commit_phid) {
+ return pht(
+ '%s changed the task status from "%s" to "%s" by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $old_name,
+ $new_name,
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s changed the task status from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $old_name,
+ $new_name);
+ }
}
case self::TYPE_UNBLOCK:
@@ -590,32 +640,70 @@
$old_name = ManiphestTaskStatus::getTaskStatusName($old);
$new_name = ManiphestTaskStatus::getTaskStatusName($new);
+ $commit_phid = $this->getMetadataValue('commitPHID');
+
if ($new_closed && !$old_closed) {
if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
+ if ($commit_phid) {
+ return pht(
+ '%s closed %s as a duplicate by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s closed %s as a duplicate.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ }
+ } else {
+ if ($commit_phid) {
+ return pht(
+ '%s closed %s as "%s" by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ $new_name,
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s closed %s as "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ $new_name);
+ }
+ }
+ } else if (!$new_closed && $old_closed) {
+ if ($commit_phid) {
return pht(
- '%s closed %s as a duplicate.',
+ '%s reopened %s as "%s" by committing %s.',
$this->renderHandleLink($author_phid),
- $this->renderHandleLink($object_phid));
+ $this->renderHandleLink($object_phid),
+ $new_name,
+ $this->renderHandleLink($commit_phid));
} else {
return pht(
- '%s closed %s as "%s".',
+ '%s reopened %s as "%s".',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$new_name);
}
- } else if (!$new_closed && $old_closed) {
- return pht(
- '%s reopened %s as "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderHandleLink($object_phid),
- $new_name);
} else {
- return pht(
- '%s changed the status of %s from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderHandleLink($object_phid),
- $old_name,
- $new_name);
+ if ($commit_phid) {
+ return pht(
+ '%s changed the status of %s from "%s" to "%s" by committing %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ $old_name,
+ $new_name,
+ $this->renderHandleLink($commit_phid));
+ } else {
+ return pht(
+ '%s changed the status of %s from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ $old_name,
+ $new_name);
+ }
}
case self::TYPE_UNBLOCK:
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -466,7 +466,7 @@
$xactions = array();
$edge_type = ManiphestTaskHasCommitEdgeType::EDGECONST;
- $xactions[] = id(new ManiphestTransaction())
+ $edge_xaction = id(new ManiphestTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(
@@ -481,23 +481,15 @@
if ($task->getStatus() != $status) {
$xactions[] = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransaction::TYPE_STATUS)
+ ->setMetadataValue('commitPHID', $commit->getPHID())
->setNewValue($status);
- $commit_name = $repository->formatCommitName(
- $commit->getCommitIdentifier());
-
- $status_message = pht(
- 'Closed by commit %s.',
- $commit_name);
-
- $xactions[] = id(new ManiphestTransaction())
- ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
- ->attachComment(
- id(new ManiphestTransactionComment())
- ->setContent($status_message));
+ $edge_xaction->setMetadataValue('commitPHID', $commit->getPHID());
}
}
+ $xactions[] = $edge_xaction;
+
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_DAEMON,
array());

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 22, 12:50 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729516
Default Alt Text
D11230.diff (8 KB)

Event Timeline