Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/diff/view/PHUIDiffInlineCommentPreviewListView.php
12242 views
1
<?php
2
3
final class PHUIDiffInlineCommentPreviewListView
4
extends AphrontView {
5
6
private $inlineComments = array();
7
private $ownerPHID;
8
9
public function setInlineComments(array $comments) {
10
assert_instances_of($comments, 'PhabricatorApplicationTransactionComment');
11
$this->inlineComments = $comments;
12
return $this;
13
}
14
15
public function getInlineComments() {
16
return $this->inlineComments;
17
}
18
19
public function setOwnerPHID($owner_phid) {
20
$this->ownerPHID = $owner_phid;
21
return $this;
22
}
23
24
public function getOwnerPHID() {
25
return $this->ownerPHID;
26
}
27
28
public function render() {
29
$viewer = $this->getViewer();
30
31
$inlines = $this->getInlineComments();
32
foreach ($inlines as $key => $inline) {
33
$inlines[$key] = $inline->newInlineCommentObject();
34
}
35
36
$engine = new PhabricatorMarkupEngine();
37
$engine->setViewer($viewer);
38
foreach ($inlines as $inline) {
39
$engine->addObject(
40
$inline,
41
PhabricatorInlineComment::MARKUP_FIELD_BODY);
42
}
43
$engine->process();
44
45
$owner_phid = $this->getOwnerPHID();
46
47
$handles = $viewer->loadHandles(array($viewer->getPHID()));
48
$handles = iterator_to_array($handles);
49
50
$views = array();
51
foreach ($inlines as $inline) {
52
$views[] = id(new PHUIDiffInlineCommentDetailView())
53
->setUser($viewer)
54
->setInlineComment($inline)
55
->setMarkupEngine($engine)
56
->setHandles($handles)
57
->setEditable(false)
58
->setPreview(true)
59
->setCanMarkDone(false)
60
->setObjectOwnerPHID($owner_phid);
61
}
62
63
return $views;
64
}
65
66
}
67
68