Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/controller/PhabricatorPasteViewController.php
| <?php | <?php | ||||
| /** | |||||
| * group paste | |||||
| */ | |||||
| final class PhabricatorPasteViewController extends PhabricatorPasteController { | final class PhabricatorPasteViewController extends PhabricatorPasteController { | ||||
| private $highlightMap; | private $highlightMap; | ||||
| public function shouldAllowPublic() { | public function shouldAllowPublic() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| $crumbs = $this->buildApplicationCrumbs() | $crumbs = $this->buildApplicationCrumbs() | ||||
| ->addTextCrumb('P'.$paste->getID(), '/P'.$paste->getID()); | ->addTextCrumb('P'.$paste->getID(), '/P'.$paste->getID()); | ||||
| $timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
| $paste, | $paste, | ||||
| new PhabricatorPasteTransactionQuery()); | new PhabricatorPasteTransactionQuery()); | ||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $comment_view = id(new PhabricatorPasteEditEngine()) | ||||
| ->setViewer($viewer) | |||||
| $add_comment_header = $is_serious | ->buildEditEngineCommentView($paste); | ||||
| ? pht('Add Comment') | |||||
| : pht('Eat Paste'); | |||||
| $draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID()); | |||||
| $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) | |||||
| ->setUser($viewer) | |||||
| ->setObjectPHID($paste->getPHID()) | |||||
| ->setDraft($draft) | |||||
| ->setHeaderText($add_comment_header) | |||||
| ->setAction($this->getApplicationURI('/comment/'.$paste->getID().'/')) | |||||
| ->setSubmitButtonName(pht('Add Comment')); | |||||
| return $this->newPage() | return $this->newPage() | ||||
| ->setTitle($paste->getFullName()) | ->setTitle($paste->getFullName()) | ||||
| ->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
| ->setPageObjectPHIDs( | ->setPageObjectPHIDs( | ||||
| array( | array( | ||||
| $paste->getPHID(), | $paste->getPHID(), | ||||
| )) | )) | ||||
| ->appendChild( | ->appendChild( | ||||
| array( | array( | ||||
| $object_box, | $object_box, | ||||
| $source_code, | $source_code, | ||||
| $timeline, | $timeline, | ||||
| $add_comment_form, | $comment_view, | ||||
| )); | )); | ||||
| } | } | ||||
| private function buildHeaderView(PhabricatorPaste $paste) { | private function buildHeaderView(PhabricatorPaste $paste) { | ||||
| $title = (nonempty($paste->getTitle())) ? | $title = (nonempty($paste->getTitle())) ? | ||||
| $paste->getTitle() : pht('(An Untitled Masterwork)'); | $paste->getTitle() : pht('(An Untitled Masterwork)'); | ||||
| if ($paste->isArchived()) { | if ($paste->isArchived()) { | ||||
| ▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines | |||||