diff --git a/src/applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php index 9d87d616c0..3e2f1343f7 100644 --- a/src/applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php @@ -12,21 +12,12 @@ final class ReleephDiffMessageFieldSpecification } public function renderValueForHeaderView() { - $commit_data = $this - ->getReleephRequest() - ->loadPhabricatorRepositoryCommitData(); - if (!$commit_data) { - return ''; - } - - $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); - $engine->setConfig('viewer', $this->getUser()); $markup = phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', ), - $engine->markupText($commit_data->getCommitMessage())); + $this->getMarkupEngineOutput()); return id(new AphrontNoteView()) ->setTitle('Commit Message') @@ -34,4 +25,19 @@ final class ReleephDiffMessageFieldSpecification ->render(); } + public function shouldMarkup() { + return true; + } + + public function getMarkupText($field) { + $commit_data = $this + ->getReleephRequest() + ->loadPhabricatorRepositoryCommitData(); + if ($commit_data) { + return $commit_data->getCommitMessage(); + } else { + return ''; + } + } + } diff --git a/src/applications/releeph/field/specification/ReleephFieldSpecification.php b/src/applications/releeph/field/specification/ReleephFieldSpecification.php index 992808f12f..a93d258210 100644 --- a/src/applications/releeph/field/specification/ReleephFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephFieldSpecification.php @@ -1,6 +1,7 @@ engine->getOutput($this, self::MARKUP_FIELD_GENERIC); + } + + final public function setMarkupEngine(PhabricatorMarkupEngine $engine) { + $this->engine = $engine; + $engine->addObject($this, self::MARKUP_FIELD_GENERIC); + return $this; + } + + final public function getMarkupFieldKey($field) { + return sprintf( + '%s:%s:%s:%s', + $this->getReleephRequest()->getPHID(), + $this->getStorageKey(), + $field, + PhabricatorHash::digest($this->getMarkupText($field))); + } + + final public function newMarkupEngine($field) { + return PhabricatorMarkupEngine::newDifferentialMarkupEngine(); + } + + final public function didMarkupText( + $field, + $output, + PhutilMarkupEngine $engine) { + + return $output; + } + + final public function shouldUseMarkupCache($field) { + return true; + } + + /* -( Implementation )----------------------------------------------------- */ protected function getRequiredStorageKey() { diff --git a/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php b/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php index 7b805cd490..c243e3090d 100644 --- a/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php @@ -16,19 +16,12 @@ final class ReleephReasonFieldSpecification } public function renderValueForHeaderView() { - $reason = $this->getValue(); - if (!$reason) { - return ''; - } - - $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); - $engine->setConfig('viewer', $this->getUser()); $markup = phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', ), - $engine->markupText($reason)); + $this->getMarkupEngineOutput()); return id(new AphrontNoteView()) ->setTitle('Reason') @@ -75,4 +68,17 @@ final class ReleephReasonFieldSpecification return $this->getValue(); } + public function shouldMarkup() { + return true; + } + + public function getMarkupText($field) { + $reason = $this->getValue(); + if ($reason) { + return $reason; + } else { + return ''; + } + } + } diff --git a/src/applications/releeph/view/request/header/ReleephRequestHeaderListView.php b/src/applications/releeph/view/request/header/ReleephRequestHeaderListView.php index 26631172ad..82a9da27e0 100644 --- a/src/applications/releeph/view/request/header/ReleephRequestHeaderListView.php +++ b/src/applications/releeph/view/request/header/ReleephRequestHeaderListView.php @@ -90,10 +90,26 @@ final class ReleephRequestHeaderListView } } - $field_groups = $selector->arrangeFieldsForHeaderView($fields); + $engine = id(new PhabricatorMarkupEngine()) + ->setViewer($this->getUser()); $views = array(); foreach ($this->releephRequests as $releeph_request) { + $our_fields = array(); + foreach ($fields as $key => $field) { + $our_fields[$key] = clone $field; + } + + foreach ($our_fields as $field) { + if ($field->shouldMarkup()) { + $field + ->setReleephRequest($releeph_request) + ->setMarkupEngine($engine); + } + } + + $our_field_groups = $selector->arrangeFieldsForHeaderView($our_fields); + $views[] = id(new ReleephRequestHeaderView()) ->setUser($this->user) ->setAphrontRequest($this->aphrontRequest) @@ -101,10 +117,11 @@ final class ReleephRequestHeaderListView ->setReleephProject($this->releephProject) ->setReleephBranch($this->releephBranch) ->setReleephRequest($releeph_request) - ->setReleephFieldGroups($field_groups) - ->render(); + ->setReleephFieldGroups($our_field_groups); } + $engine->process(); + return $views; }