@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.

When adding `{Fnnn}` file references by editing comments, link objects to files

Summary: Fixes T6037. We don't currently write the "this file is attached to such-and-such object" edge on comment edits.

Test Plan: Edited a comment, adding `{Fnnn}`. Verified file was not attached before the edit, but was afterward.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6037

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

+18 -3
+18 -3
src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
··· 46 46 $comment->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC); 47 47 $comment->setEditPolicy($this->getActingAsPHID()); 48 48 49 + $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles( 50 + $actor, 51 + array( 52 + $comment->getContent(), 53 + )); 54 + 49 55 $xaction->openTransaction(); 50 56 $xaction->beginReadLocking(); 51 57 if ($xaction->getID()) { ··· 67 73 $xaction->endReadLocking(); 68 74 $xaction->saveTransaction(); 69 75 76 + // Add links to any files newly referenced by the edit. 77 + if ($file_phids) { 78 + $editor = new PhabricatorEdgeEditor(); 79 + foreach ($file_phids as $file_phid) { 80 + $editor->addEdge( 81 + $xaction->getObjectPHID(), 82 + PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE, 83 + $file_phid); 84 + } 85 + $editor->save(); 86 + } 87 + 70 88 $xaction->attachComment($comment); 71 - 72 - // TODO: Emit an event for notifications/feed? Can we handle them 73 - // generically? 74 89 75 90 return $this; 76 91 }