From 34a90a0d2b4d04fd101817dd56b78b7bafb50ce9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 21 Aug 2014 17:00:12 -0700 Subject: [PATCH] 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 --- .../standard/PhabricatorStandardCustomFieldRemarkup.php | 7 +++++++ src/infrastructure/markup/PhabricatorMarkupEngine.php | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php index d05d5a9aba..d67c51bb29 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -19,6 +19,13 @@ final class PhabricatorStandardCustomFieldRemarkup return 'block'; } + public function getApplicationTransactionRemarkupBlocks( + PhabricatorApplicationTransaction $xaction) { + return array( + $xaction->getNewValue(), + ); + } + public function renderPropertyViewValue(array $handles) { $value = $this->getFieldValue(); diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index 8a88ee0337..b089de654d 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -530,13 +530,15 @@ final class PhabricatorMarkupEngine { foreach ($content_blocks as $content_block) { $engine->markupText($content_block); - $ids = $engine->getTextMetadata( + $phids = $engine->getTextMetadata( PhabricatorEmbedFileRemarkupRule::KEY_EMBED_FILE_PHIDS, array()); - $files += $ids; + foreach ($phids as $phid) { + $files[$phid] = $phid; + } } - return $files; + return array_values($files); } /**