Skip to content

Commit 34a90a0

Browse files
author
epriestley
committed
Recognize remarkup custom fields as remarkup blocks
Summary: Fixes T5916. Key insight here is that the screenshot shows a custom "Detail Solution / Notes" field, which is why this mojo doesn't work: custom remarkup fields don't emit their content for mention/file extraction. Also fix a bug where multiple blocks with file PHIDs could be merged improperly, discarding some file PHIDs. Test Plan: Added a custom remarkup field, added files to it, saw them attach to the task when changes were saved. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5916 Differential Revision: https://secure.phabricator.com/D10335
1 parent d83a9c6 commit 34a90a0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ public function getStyleForPropertyView() {
1919
return 'block';
2020
}
2121

22+
public function getApplicationTransactionRemarkupBlocks(
23+
PhabricatorApplicationTransaction $xaction) {
24+
return array(
25+
$xaction->getNewValue(),
26+
);
27+
}
28+
2229
public function renderPropertyViewValue(array $handles) {
2330
$value = $this->getFieldValue();
2431

src/infrastructure/markup/PhabricatorMarkupEngine.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,15 @@ public static function extractFilePHIDsFromEmbeddedFiles(
530530

531531
foreach ($content_blocks as $content_block) {
532532
$engine->markupText($content_block);
533-
$ids = $engine->getTextMetadata(
533+
$phids = $engine->getTextMetadata(
534534
PhabricatorEmbedFileRemarkupRule::KEY_EMBED_FILE_PHIDS,
535535
array());
536-
$files += $ids;
536+
foreach ($phids as $phid) {
537+
$files[$phid] = $phid;
538+
}
537539
}
538540

539-
return $files;
541+
return array_values($files);
540542
}
541543

542544
/**

0 commit comments

Comments
 (0)