1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 02:31:10 +01:00

Restore quote and warning behaviors to Differential EditEngine comment area

Summary: Ref T11114. This restores warnings (e.g., failing unit tests) and fixes "Quote" behavior for comments.

Test Plan:
  - Quoted a comment.
  - Viewed a warning.

{F2283275}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

Differential Revision: https://secure.phabricator.com/D17117
This commit is contained in:
epriestley 2016-12-31 08:59:37 -08:00
parent 18249b097f
commit 9b4090af55
2 changed files with 55 additions and 20 deletions

View file

@ -255,17 +255,14 @@ final class DifferentialRevisionViewController extends DifferentialController {
$target, $target,
$revision); $revision);
$comment_view = $this->buildTransactions( $timeline = $this->buildTransactions(
$revision, $revision,
$diff_vs ? $diffs[$diff_vs] : $target, $diff_vs ? $diffs[$diff_vs] : $target,
$target, $target,
$old_ids, $old_ids,
$new_ids); $new_ids);
if (!$viewer_is_anonymous) { $timeline->setQuoteRef($revision->getMonogram());
$comment_view->setQuoteRef('D'.$revision->getID());
$comment_view->setQuoteTargetID('comment-content');
}
$changeset_view = id(new DifferentialChangesetListView()) $changeset_view = id(new DifferentialChangesetListView())
->setChangesets($changesets) ->setChangesets($changesets)
@ -421,15 +418,33 @@ final class DifferentialRevisionViewController extends DifferentialController {
); );
} }
$footer[] = id(new DifferentialRevisionEditEngine()) $comment_view = id(new DifferentialRevisionEditEngine())
->setViewer($viewer) ->setViewer($viewer)
->buildEditEngineCommentView($revision); ->buildEditEngineCommentView($revision);
$object_id = 'D'.$revision->getID(); $comment_view->setTransactionTimeline($timeline);
$review_warnings = array();
foreach ($field_list->getFields() as $field) {
$review_warnings[] = $field->getWarningsForDetailView();
}
$review_warnings = array_mergev($review_warnings);
if ($review_warnings) {
$warnings_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->setErrors($review_warnings);
$comment_view->setInfoView($warnings_view);
}
$footer[] = $comment_view;
$monogram = $revision->getMonogram();
$operations_box = $this->buildOperationsBox($revision); $operations_box = $this->buildOperationsBox($revision);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($object_id, '/'.$object_id); $crumbs->addTextCrumb($monogram, $revision->getURI());
$crumbs->setBorder(true); $crumbs->setBorder(true);
$filetree_on = $viewer->compareUserSetting( $filetree_on = $viewer->compareUserSetting(
@ -442,8 +457,8 @@ final class DifferentialRevisionViewController extends DifferentialController {
$collapsed_value = $viewer->getUserSetting($collapsed_key); $collapsed_value = $viewer->getUserSetting($collapsed_key);
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder()) $nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setTitle('D'.$revision->getID()) ->setTitle($monogram)
->setBaseURI(new PhutilURI('/D'.$revision->getID())) ->setBaseURI(new PhutilURI($revision->getURI()))
->setCollapsed((bool)$collapsed_value) ->setCollapsed((bool)$collapsed_value)
->build($changesets); ->build($changesets);
} }
@ -454,19 +469,20 @@ final class DifferentialRevisionViewController extends DifferentialController {
->setHeader($header) ->setHeader($header)
->setSubheader($subheader) ->setSubheader($subheader)
->setCurtain($curtain) ->setCurtain($curtain)
->setMainColumn(array( ->setMainColumn(
$operations_box, array(
$info_view, $operations_box,
$details, $info_view,
$diff_detail_box, $details,
$unit_box, $diff_detail_box,
$comment_view, $unit_box,
$signature_message, $timeline,
)) $signature_message,
))
->setFooter($footer); ->setFooter($footer);
$page = $this->newPage() $page = $this->newPage()
->setTitle($object_id.' '.$revision->getTitle()) ->setTitle($monogram.' '.$revision->getTitle())
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setPageObjectPHIDs(array($revision->getPHID())) ->setPageObjectPHIDs(array($revision->getPHID()))
->appendChild($view); ->appendChild($view);

View file

@ -20,6 +20,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
private $headerText; private $headerText;
private $noPermission; private $noPermission;
private $fullWidth; private $fullWidth;
private $infoView;
private $currentVersion; private $currentVersion;
private $versionedDraft; private $versionedDraft;
@ -109,6 +110,15 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
return $this; return $this;
} }
public function setInfoView(PHUIInfoView $info_view) {
$this->infoView = $info_view;
return $this;
}
public function getInfoView() {
return $this->infoView;
}
public function setCommentActions(array $comment_actions) { public function setCommentActions(array $comment_actions) {
assert_instances_of($comment_actions, 'PhabricatorEditEngineCommentAction'); assert_instances_of($comment_actions, 'PhabricatorEditEngineCommentAction');
$this->commentActions = $comment_actions; $this->commentActions = $comment_actions;
@ -334,6 +344,15 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
)); ));
$form->appendChild($action_bar); $form->appendChild($action_bar);
$info_view = $this->getInfoView();
if ($info_view) {
$info_box = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
->appendChild($info_view);
$form->appendChild($info_box);
}
$form->appendChild($invisi_bar); $form->appendChild($invisi_bar);
$form->addClass('phui-comment-has-actions'); $form->addClass('phui-comment-has-actions');