1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/applications/diffusion/view/DiffusionCommentListView.php
vrana 6cc196a2e5 Move files in Phabricator one level up
Summary:
- `kill_init.php` said "Moving 1000 files" - I hope that this is not some limit in `FileFinder`.
- [src/infrastructure/celerity] `git mv utils.php map.php; git mv api/utils.php api.php`
- Comment `phutil_libraries` in `.arcconfig` and run `arc liberate`.

NOTE: `arc diff` timed out so I'm pushing it without review.

Test Plan:
/D1234
Browsed around, especially in `applications/repository/worker/commitchangeparser` and `applications/` in general.

Auditors: epriestley

Maniphest Tasks: T1103
2012-06-01 12:32:44 -07:00

106 lines
2.9 KiB
PHP

<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class DiffusionCommentListView extends AphrontView {
private $user;
private $comments;
private $inlineComments = array();
private $pathMap = array();
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function setComments(array $comments) {
assert_instances_of($comments, 'PhabricatorAuditComment');
$this->comments = $comments;
return $this;
}
public function setInlineComments(array $inline_comments) {
assert_instances_of($inline_comments, 'PhabricatorInlineCommentInterface');
$this->inlineComments = $inline_comments;
return $this;
}
public function setPathMap(array $path_map) {
$this->pathMap = $path_map;
return $this;
}
public function getRequiredHandlePHIDs() {
$phids = array();
foreach ($this->comments as $comment) {
$phids[$comment->getActorPHID()] = true;
$metadata = $comment->getMetaData();
$ccs_key = PhabricatorAuditComment::METADATA_ADDED_CCS;
$added_ccs = idx($metadata, $ccs_key, array());
foreach ($added_ccs as $cc) {
$phids[$cc] = true;
}
$auditors_key = PhabricatorAuditComment::METADATA_ADDED_AUDITORS;
$added_auditors = idx($metadata, $auditors_key, array());
foreach ($added_auditors as $auditor) {
$phids[$auditor] = true;
}
}
foreach ($this->inlineComments as $comment) {
$phids[$comment->getAuthorPHID()] = true;
}
return array_keys($phids);
}
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function render() {
$inline_comments = mgroup($this->inlineComments, 'getAuditCommentID');
$num = 1;
$comments = array();
foreach ($this->comments as $comment) {
$inlines = idx($inline_comments, $comment->getID(), array());
$view = id(new DiffusionCommentView())
->setComment($comment)
->setInlineComments($inlines)
->setCommentNumber($num)
->setHandles($this->handles)
->setPathMap($this->pathMap)
->setUser($this->user);
$comments[] = $view->render();
++$num;
}
return
'<div class="diffusion-comment-list">'.
$this->renderSingleView($comments).
'</div>';
}
}