Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/storage/DifferentialInlineComment.php
12256 views
1
<?php
2
3
final class DifferentialInlineComment
4
extends PhabricatorInlineComment {
5
6
protected function newStorageObject() {
7
return new DifferentialTransactionComment();
8
}
9
10
public function getControllerURI() {
11
return urisprintf(
12
'/differential/comment/inline/edit/%s/',
13
$this->getRevisionID());
14
}
15
16
public function getTransactionCommentForSave() {
17
$content_source = PhabricatorContentSource::newForSource(
18
PhabricatorOldWorldContentSource::SOURCECONST);
19
20
$this->getStorageObject()
21
->setViewPolicy('public')
22
->setEditPolicy($this->getAuthorPHID())
23
->setContentSource($content_source)
24
->attachIsHidden(false)
25
->setCommentVersion(1);
26
27
return $this->getStorageObject();
28
}
29
30
public function supportsHiding() {
31
if ($this->getSyntheticAuthor()) {
32
return false;
33
}
34
return true;
35
}
36
37
public function isHidden() {
38
if (!$this->supportsHiding()) {
39
return false;
40
}
41
return $this->getStorageObject()->getIsHidden();
42
}
43
44
public static function newFromModernComment(
45
DifferentialTransactionComment $comment) {
46
47
$obj = new DifferentialInlineComment();
48
$obj->setStorageObject($comment);
49
50
return $obj;
51
}
52
53
public function setChangesetID($id) {
54
$this->getStorageObject()->setChangesetID($id);
55
return $this;
56
}
57
58
public function getChangesetID() {
59
return $this->getStorageObject()->getChangesetID();
60
}
61
62
public function setRevision(DifferentialRevision $revision) {
63
$this->getStorageObject()->setRevisionPHID($revision->getPHID());
64
return $this;
65
}
66
67
public function getRevisionPHID() {
68
return $this->getStorageObject()->getRevisionPHID();
69
}
70
71
// Although these are purely transitional, they're also *extra* dumb.
72
73
public function setRevisionID($revision_id) {
74
$revision = id(new DifferentialRevision())->load($revision_id);
75
return $this->setRevision($revision);
76
}
77
78
public function getRevisionID() {
79
$phid = $this->getStorageObject()->getRevisionPHID();
80
if (!$phid) {
81
return null;
82
}
83
84
$revision = id(new DifferentialRevision())->loadOneWhere(
85
'phid = %s',
86
$phid);
87
if (!$revision) {
88
return null;
89
}
90
return $revision->getID();
91
}
92
93
}
94
95