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

View file

@ -20,6 +20,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
private $headerText;
private $noPermission;
private $fullWidth;
private $infoView;
private $currentVersion;
private $versionedDraft;
@ -109,6 +110,15 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
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) {
assert_instances_of($comment_actions, 'PhabricatorEditEngineCommentAction');
$this->commentActions = $comment_actions;
@ -334,6 +344,15 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
));
$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->addClass('phui-comment-has-actions');