@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3abstract class PHUIDiffInlineCommentView extends AphrontView {
4
5 private $isOnRight;
6 private $renderer;
7 private $inlineComment;
8
9 public function setInlineComment(PhabricatorInlineComment $comment) {
10 $this->inlineComment = $comment;
11 return $this;
12 }
13
14 public function getInlineComment() {
15 return $this->inlineComment;
16 }
17
18 public function getIsOnRight() {
19 return $this->isOnRight;
20 }
21
22 public function setIsOnRight($on_right) {
23 $this->isOnRight = $on_right;
24 return $this;
25 }
26
27 public function setRenderer($renderer) {
28 $this->renderer = $renderer;
29 return $this;
30 }
31
32 public function getRenderer() {
33 return $this->renderer;
34 }
35
36 public function getScaffoldCellID() {
37 return null;
38 }
39
40 public function isHidden() {
41 return false;
42 }
43
44 public function isHideable() {
45 return true;
46 }
47
48 public function newHiddenIcon() {
49 if ($this->isHideable()) {
50 return new PHUIDiffRevealIconView();
51 } else {
52 return null;
53 }
54 }
55
56 protected function getInlineCommentMetadata() {
57 $viewer = $this->getViewer();
58 $inline = $this->getInlineComment();
59
60 $is_synthetic = (bool)$inline->getSyntheticAuthor();
61
62 $is_fixed = false;
63 switch ($inline->getFixedState()) {
64 case PhabricatorInlineComment::STATE_DONE:
65 case PhabricatorInlineComment::STATE_DRAFT:
66 $is_fixed = true;
67 break;
68 }
69
70 $is_draft_done = false;
71 switch ($inline->getFixedState()) {
72 case PhabricatorInlineComment::STATE_DRAFT:
73 case PhabricatorInlineComment::STATE_UNDRAFT:
74 $is_draft_done = true;
75 break;
76 }
77
78 return array(
79 'id' => $inline->getID(),
80 'phid' => $inline->getPHID(),
81 'changesetID' => $inline->getChangesetID(),
82 'number' => $inline->getLineNumber(),
83 'length' => $inline->getLineLength(),
84 'isNewFile' => (bool)$inline->getIsNewFile(),
85 'replyToCommentPHID' => $inline->getReplyToCommentPHID(),
86 'isDraft' => $inline->isDraft(),
87 'isFixed' => $is_fixed,
88 'isGhost' => $inline->getIsGhost(),
89 'isSynthetic' => $is_synthetic,
90 'isDraftDone' => $is_draft_done,
91 'isEditing' => $inline->getIsEditing(),
92 'documentEngineKey' => $inline->getDocumentEngineKey(),
93 'startOffset' => $inline->getStartOffset(),
94 'endOffset' => $inline->getEndOffset(),
95 'on_right' => $this->getIsOnRight(),
96 'state' => $inline->getContentStateMap(),
97 );
98 }
99
100
101}