@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Attach mentioned Maniphest task also to revision

Summary: Also disable this feature without 'maniphest.enabled'.

Test Plan:
Wrote "fixes T..." in `arc diff`, verified that the task is attached.
Add another "fixes T..." in edit revision on web, verified that it was added.
Deleted "fixes T..." in edit revision, verified that the attached task wasn't deleted.

Reviewers: 20after4, epriestley

Reviewed By: 20after4

CC: aran, Korvin

Maniphest Tasks: T945

Differential Revision: https://secure.phabricator.com/D3986

vrana 97a97f53 58716521

+32
+32
src/applications/differential/field/specification/DifferentialFreeformFieldSpecification.php
··· 4 4 extends DifferentialFieldSpecification { 5 5 6 6 private function findMentionedTasks($message) { 7 + if (!PhabricatorEnv::getEnvConfig('maniphest.enabled')) { 8 + return array(); 9 + } 10 + 7 11 $prefixes = array( 8 12 'resolves' => ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, 9 13 'fixes' => ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, ··· 65 69 } 66 70 67 71 return $tasks_statuses; 72 + } 73 + 74 + public function didWriteRevision(DifferentialRevisionEditor $editor) { 75 + $message = $this->renderValueForCommitMessage(false); 76 + $tasks = $this->findMentionedTasks($message); 77 + if (!$tasks) { 78 + return; 79 + } 80 + 81 + $revision_phid = $editor->getRevision()->getPHID(); 82 + $edge_type = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK; 83 + 84 + $add_phids = id(new ManiphestTask()) 85 + ->loadAllWhere('id IN (%Ld)', array_keys($tasks)); 86 + $add_phids = mpull($add_phids, 'getPHID'); 87 + 88 + $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( 89 + $revision_phid, 90 + $edge_type); 91 + 92 + $add_phids = array_diff($add_phids, $old_phids); 93 + 94 + $edge_editor = id(new PhabricatorEdgeEditor())->setActor($this->getUser()); 95 + foreach ($add_phids as $phid) { 96 + $edge_editor->addEdge($revision_phid, $edge_type, $phid); 97 + } 98 + // NOTE: Deletes only through Maniphest Tasks field. 99 + $edge_editor->save(); 68 100 } 69 101 70 102 public function didParseCommit(