@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+8 -21
+8 -9
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 80 80 $comments); 81 81 82 82 $all_changesets = $changesets; 83 - $inlines = $this->loadInlineComments($comments, $all_changesets); 83 + $inlines = $this->loadInlineComments( 84 + $revision, 85 + $all_changesets); 84 86 85 87 $object_phids = array_merge( 86 88 $revision->getReviewers(), ··· 629 631 return $actions_dict; 630 632 } 631 633 632 - private function loadInlineComments(array $comments, array &$changesets) { 633 - assert_instances_of($comments, 'DifferentialComment'); 634 + private function loadInlineComments( 635 + DifferentialRevision $revision, 636 + array &$changesets) { 634 637 assert_instances_of($changesets, 'DifferentialChangeset'); 635 638 636 639 $inline_comments = array(); 637 640 638 - $comment_ids = array_filter(mpull($comments, 'getID')); 639 - if (!$comment_ids) { 640 - return $inline_comments; 641 - } 642 - 643 641 $inline_comments = id(new DifferentialInlineCommentQuery()) 644 - ->withCommentIDs($comment_ids) 642 + ->withRevisionIDs(array($revision->getID())) 643 + ->withNotDraft(true) 645 644 ->execute(); 646 645 647 646 $load_changesets = array();
-12
src/applications/differential/query/DifferentialInlineCommentQuery.php
··· 30 30 return $this; 31 31 } 32 32 33 - public function withCommentIDs(array $ids) { 34 - $this->commentIDs = $ids; 35 - return $this; 36 - } 37 - 38 33 public function withViewerAndChangesetIDs($author_phid, array $ids) { 39 34 $this->viewerAndChangesetIDs = array($author_phid, $ids); 40 35 return $this; ··· 89 84 $conn_r, 90 85 'id IN (%Ld)', 91 86 $this->ids); 92 - } 93 - 94 - if ($this->commentIDs) { 95 - $where[] = qsprintf( 96 - $conn_r, 97 - 'commentID in (%Ld)', 98 - $this->commentIDs); 99 87 } 100 88 101 89 if ($this->viewerAndChangesetIDs) {