Differential D21828 Diff 52016 src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | $comment_box = id(new PHUIObjectBoxView()) | ||||
->appendChild($badge_view) | ->appendChild($badge_view) | ||||
->appendChild($wedge) | ->appendChild($wedge) | ||||
->appendChild($comment); | ->appendChild($comment); | ||||
return array($comment_box, $preview); | return array($comment_box, $preview); | ||||
} | } | ||||
private function renderCommentPanel() { | private function renderCommentPanel() { | ||||
$viewer = $this->getViewer(); | |||||
$remarkup_control = id(new PhabricatorRemarkupControl()) | |||||
->setViewer($viewer) | |||||
->setID($this->getCommentID()) | |||||
->addClass('phui-comment-fullwidth-control') | |||||
->addClass('phui-comment-textarea-control') | |||||
->setCanPin(true) | |||||
->setName('comment'); | |||||
$draft_comment = ''; | $draft_comment = ''; | ||||
$draft_metadata = array(); | |||||
$draft_key = null; | $draft_key = null; | ||||
if ($this->getDraft()) { | |||||
$draft_comment = $this->getDraft()->getDraft(); | $legacy_draft = $this->getDraft(); | ||||
$draft_key = $this->getDraft()->getDraftKey(); | if ($legacy_draft) { | ||||
$draft_comment = $legacy_draft->getDraft(); | |||||
$draft_key = $legacy_draft->getDraftKey(); | |||||
} | } | ||||
$versioned_draft = $this->getVersionedDraft(); | $versioned_draft = $this->getVersionedDraft(); | ||||
if ($versioned_draft) { | if ($versioned_draft) { | ||||
$draft_comment = $versioned_draft->getProperty('comment', ''); | $draft_comment = $versioned_draft->getProperty( | ||||
'comment', | |||||
$draft_comment); | |||||
$draft_metadata = $versioned_draft->getProperty( | |||||
'metadata', | |||||
$draft_metadata); | |||||
} | } | ||||
$remarkup_control->setValue($draft_comment); | |||||
$remarkup_control->setRemarkupMetadata($draft_metadata); | |||||
if (!$this->getObjectPHID()) { | if (!$this->getObjectPHID()) { | ||||
throw new PhutilInvalidStateException('setObjectPHID', 'render'); | throw new PhutilInvalidStateException('setObjectPHID', 'render'); | ||||
} | } | ||||
$version_key = PhabricatorVersionedDraft::KEY_VERSION; | $version_key = PhabricatorVersionedDraft::KEY_VERSION; | ||||
$version_value = $this->getCurrentVersion(); | $version_value = $this->getCurrentVersion(); | ||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($this->getUser()) | ->setUser($viewer) | ||||
->addSigil('transaction-append') | ->addSigil('transaction-append') | ||||
->setWorkflow(true) | ->setWorkflow(true) | ||||
->setFullWidth($this->fullWidth) | ->setFullWidth($this->fullWidth) | ||||
->setMetadata( | ->setMetadata( | ||||
array( | array( | ||||
'objectPHID' => $this->getObjectPHID(), | 'objectPHID' => $this->getObjectPHID(), | ||||
)) | )) | ||||
->setAction($this->getAction()) | ->setAction($this->getAction()) | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | private function renderCommentPanel() { | ||||
} | } | ||||
$submit_button = id(new AphrontFormSubmitControl()) | $submit_button = id(new AphrontFormSubmitControl()) | ||||
->addClass('phui-comment-fullwidth-control') | ->addClass('phui-comment-fullwidth-control') | ||||
->addClass('phui-comment-submit-control') | ->addClass('phui-comment-submit-control') | ||||
->setValue($this->getSubmitButtonName()); | ->setValue($this->getSubmitButtonName()); | ||||
$form | $form | ||||
->appendChild( | ->appendChild($remarkup_control) | ||||
id(new PhabricatorRemarkupControl()) | |||||
->setID($this->getCommentID()) | |||||
->addClass('phui-comment-fullwidth-control') | |||||
->addClass('phui-comment-textarea-control') | |||||
->setCanPin(true) | |||||
->setName('comment') | |||||
->setUser($this->getUser()) | |||||
->setValue($draft_comment)) | |||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
->addClass('phui-comment-fullwidth-control') | ->addClass('phui-comment-fullwidth-control') | ||||
->addClass('phui-comment-submit-control') | ->addClass('phui-comment-submit-control') | ||||
->addSigil('submit-transactions') | ->addSigil('submit-transactions') | ||||
->setValue($this->getSubmitButtonName())); | ->setValue($this->getSubmitButtonName())); | ||||
return $form; | return $form; | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |