Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
12256 views
1
<?php
2
3
final class PhabricatorAuditTransactionComment
4
extends PhabricatorApplicationTransactionComment
5
implements
6
PhabricatorInlineCommentInterface {
7
8
protected $commitPHID;
9
protected $pathID;
10
protected $isNewFile = 0;
11
protected $lineNumber = 0;
12
protected $lineLength = 0;
13
protected $fixedState;
14
protected $hasReplies = 0;
15
protected $replyToCommentPHID;
16
protected $legacyCommentID;
17
protected $attributes = array();
18
19
private $replyToComment = self::ATTACHABLE;
20
private $inlineContext = self::ATTACHABLE;
21
22
public function getApplicationTransactionObject() {
23
return new PhabricatorAuditTransaction();
24
}
25
26
public function shouldUseMarkupCache($field) {
27
// Only cache submitted comments.
28
return ($this->getTransactionPHID() != null);
29
}
30
31
protected function getConfiguration() {
32
$config = parent::getConfiguration();
33
34
$config[self::CONFIG_COLUMN_SCHEMA] = array(
35
'commitPHID' => 'phid?',
36
'pathID' => 'id?',
37
'isNewFile' => 'bool',
38
'lineNumber' => 'uint32',
39
'lineLength' => 'uint32',
40
'fixedState' => 'text12?',
41
'hasReplies' => 'bool',
42
'replyToCommentPHID' => 'phid?',
43
'legacyCommentID' => 'id?',
44
) + $config[self::CONFIG_COLUMN_SCHEMA];
45
46
$config[self::CONFIG_KEY_SCHEMA] = array(
47
'key_path' => array(
48
'columns' => array('pathID'),
49
),
50
'key_draft' => array(
51
'columns' => array('authorPHID', 'transactionPHID'),
52
),
53
'key_commit' => array(
54
'columns' => array('commitPHID'),
55
),
56
'key_legacy' => array(
57
'columns' => array('legacyCommentID'),
58
),
59
) + $config[self::CONFIG_KEY_SCHEMA];
60
61
$config[self::CONFIG_SERIALIZATION] = array(
62
'attributes' => self::SERIALIZATION_JSON,
63
) + idx($config, self::CONFIG_SERIALIZATION, array());
64
65
return $config;
66
}
67
68
public function attachReplyToComment(
69
PhabricatorAuditTransactionComment $comment = null) {
70
$this->replyToComment = $comment;
71
return $this;
72
}
73
74
public function getReplyToComment() {
75
return $this->assertAttached($this->replyToComment);
76
}
77
78
public function getAttribute($key, $default = null) {
79
return idx($this->attributes, $key, $default);
80
}
81
82
public function setAttribute($key, $value) {
83
$this->attributes[$key] = $value;
84
return $this;
85
}
86
87
public function newInlineCommentObject() {
88
return PhabricatorAuditInlineComment::newFromModernComment($this);
89
}
90
91
public function getInlineContext() {
92
return $this->assertAttached($this->inlineContext);
93
}
94
95
public function attachInlineContext(
96
PhabricatorInlineCommentContext $context = null) {
97
$this->inlineContext = $context;
98
return $this;
99
}
100
101
}
102
103