mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Simplify selection of inline comments from RevisionView
Summary: Ref T2222. Currently, we load inline comments by `commentID` here, but we always pass every commentID associated with the revision. Instead, just load non-draft comments by revision ID. This simplifies querying a little bit and is likely faster anyway (draft comments are currently loaded separately). Test Plan: Looked at some revisions and verified inlines showed up correctly and in the right places. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D6270
This commit is contained in:
parent
3124838d65
commit
7c2f6f8361
2 changed files with 8 additions and 21 deletions
|
@ -80,7 +80,9 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
$comments);
|
$comments);
|
||||||
|
|
||||||
$all_changesets = $changesets;
|
$all_changesets = $changesets;
|
||||||
$inlines = $this->loadInlineComments($comments, $all_changesets);
|
$inlines = $this->loadInlineComments(
|
||||||
|
$revision,
|
||||||
|
$all_changesets);
|
||||||
|
|
||||||
$object_phids = array_merge(
|
$object_phids = array_merge(
|
||||||
$revision->getReviewers(),
|
$revision->getReviewers(),
|
||||||
|
@ -629,19 +631,16 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
return $actions_dict;
|
return $actions_dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadInlineComments(array $comments, array &$changesets) {
|
private function loadInlineComments(
|
||||||
assert_instances_of($comments, 'DifferentialComment');
|
DifferentialRevision $revision,
|
||||||
|
array &$changesets) {
|
||||||
assert_instances_of($changesets, 'DifferentialChangeset');
|
assert_instances_of($changesets, 'DifferentialChangeset');
|
||||||
|
|
||||||
$inline_comments = array();
|
$inline_comments = array();
|
||||||
|
|
||||||
$comment_ids = array_filter(mpull($comments, 'getID'));
|
|
||||||
if (!$comment_ids) {
|
|
||||||
return $inline_comments;
|
|
||||||
}
|
|
||||||
|
|
||||||
$inline_comments = id(new DifferentialInlineCommentQuery())
|
$inline_comments = id(new DifferentialInlineCommentQuery())
|
||||||
->withCommentIDs($comment_ids)
|
->withRevisionIDs(array($revision->getID()))
|
||||||
|
->withNotDraft(true)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$load_changesets = array();
|
$load_changesets = array();
|
||||||
|
|
|
@ -30,11 +30,6 @@ final class DifferentialInlineCommentQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withCommentIDs(array $ids) {
|
|
||||||
$this->commentIDs = $ids;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function withViewerAndChangesetIDs($author_phid, array $ids) {
|
public function withViewerAndChangesetIDs($author_phid, array $ids) {
|
||||||
$this->viewerAndChangesetIDs = array($author_phid, $ids);
|
$this->viewerAndChangesetIDs = array($author_phid, $ids);
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -91,13 +86,6 @@ final class DifferentialInlineCommentQuery
|
||||||
$this->ids);
|
$this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->commentIDs) {
|
|
||||||
$where[] = qsprintf(
|
|
||||||
$conn_r,
|
|
||||||
'commentID in (%Ld)',
|
|
||||||
$this->commentIDs);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->viewerAndChangesetIDs) {
|
if ($this->viewerAndChangesetIDs) {
|
||||||
list($phid, $ids) = $this->viewerAndChangesetIDs;
|
list($phid, $ids) = $this->viewerAndChangesetIDs;
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
|
|
Loading…
Reference in a new issue