Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
| <?php | <?php | ||||
| abstract class PHUIDiffInlineCommentView extends AphrontView { | abstract class PHUIDiffInlineCommentView extends AphrontView { | ||||
| private $isOnRight; | private $isOnRight; | ||||
| private $renderer; | |||||
| private $inlineComment; | |||||
| public function setInlineComment(PhabricatorInlineComment $comment) { | |||||
| $this->inlineComment = $comment; | |||||
| return $this; | |||||
| } | |||||
| public function getInlineComment() { | |||||
| return $this->inlineComment; | |||||
| } | |||||
| public function getIsOnRight() { | public function getIsOnRight() { | ||||
| return $this->isOnRight; | return $this->isOnRight; | ||||
| } | } | ||||
| public function setIsOnRight($on_right) { | public function setIsOnRight($on_right) { | ||||
| $this->isOnRight = $on_right; | $this->isOnRight = $on_right; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setRenderer($renderer) { | |||||
| $this->renderer = $renderer; | |||||
| return $this; | |||||
| } | |||||
| public function getRenderer() { | |||||
| return $this->renderer; | |||||
| } | |||||
| public function getScaffoldCellID() { | public function getScaffoldCellID() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function isHidden() { | public function isHidden() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function isHideable() { | public function isHideable() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function newHiddenIcon() { | public function newHiddenIcon() { | ||||
| if ($this->isHideable()) { | if ($this->isHideable()) { | ||||
| return new PHUIDiffRevealIconView(); | return new PHUIDiffRevealIconView(); | ||||
| } else { | } else { | ||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||
| protected function getInlineCommentMetadata() { | |||||
| $inline = $this->getInlineComment(); | |||||
| $is_synthetic = (bool)$inline->getSyntheticAuthor(); | |||||
| $is_fixed = false; | |||||
| switch ($inline->getFixedState()) { | |||||
| case PhabricatorInlineComment::STATE_DONE: | |||||
| case PhabricatorInlineComment::STATE_DRAFT: | |||||
| $is_fixed = true; | |||||
| break; | |||||
| } | |||||
| $is_draft_done = false; | |||||
| switch ($inline->getFixedState()) { | |||||
| case PhabricatorInlineComment::STATE_DRAFT: | |||||
| case PhabricatorInlineComment::STATE_UNDRAFT: | |||||
| $is_draft_done = true; | |||||
| break; | |||||
| } | |||||
| return array( | |||||
| 'id' => $inline->getID(), | |||||
| 'phid' => $inline->getPHID(), | |||||
| 'changesetID' => $inline->getChangesetID(), | |||||
| 'number' => $inline->getLineNumber(), | |||||
| 'length' => $inline->getLineLength(), | |||||
| 'isNewFile' => (bool)$inline->getIsNewFile(), | |||||
| 'original' => $inline->getContent(), | |||||
| 'replyToCommentPHID' => $inline->getReplyToCommentPHID(), | |||||
| 'isDraft' => $inline->isDraft(), | |||||
| 'isFixed' => $is_fixed, | |||||
| 'isGhost' => $inline->getIsGhost(), | |||||
| 'isSynthetic' => $is_synthetic, | |||||
| 'isDraftDone' => $is_draft_done, | |||||
| 'isEditing' => $inline->getIsEditing(), | |||||
| 'on_right' => $this->getIsOnRight(), | |||||
| ); | |||||
| } | |||||
| } | } | ||||