Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14361327
D10423.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10423.diff
View Options
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
@@ -46,6 +46,12 @@
$comment->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC);
$comment->setEditPolicy($this->getActingAsPHID());
+ $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
+ $actor,
+ array(
+ $comment->getContent(),
+ ));
+
$xaction->openTransaction();
$xaction->beginReadLocking();
if ($xaction->getID()) {
@@ -67,10 +73,19 @@
$xaction->endReadLocking();
$xaction->saveTransaction();
- $xaction->attachComment($comment);
+ // Add links to any files newly referenced by the edit.
+ if ($file_phids) {
+ $editor = new PhabricatorEdgeEditor();
+ foreach ($file_phids as $file_phid) {
+ $editor->addEdge(
+ $xaction->getObjectPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE,
+ $file_phid);
+ }
+ $editor->save();
+ }
- // TODO: Emit an event for notifications/feed? Can we handle them
- // generically?
+ $xaction->attachComment($comment);
return $this;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 11:14 AM (18 h, 4 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6913758
Default Alt Text
D10423.diff (1 KB)
Attached To
Mode
D10423: When adding `{Fnnn}` file references by editing comments, link objects to files
Attached
Detach File
Event Timeline
Log In to Comment