1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Move the "Inline List" view to "DiffInlineCommentQuery"

Summary: Ref T13513. Continue removing usage sites for the obsolete "DifferentialInlineCommentQuery".

Test Plan: Viewed the inline list in Differential, saw sensible inlines.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21232
This commit is contained in:
epriestley 2020-05-07 13:02:06 -07:00
parent af5b94b234
commit 983d77848b
4 changed files with 25 additions and 24 deletions

View file

@ -24,11 +24,12 @@ final class DifferentialRevisionInlinesController
$revision_uri = $revision->getURI();
$revision_title = $revision->getTitle();
$query = id(new DifferentialInlineCommentQuery())
$inlines = id(new DifferentialDiffInlineCommentQuery())
->setViewer($viewer)
->needHidden(true)
->withRevisionPHIDs(array($revision->getPHID()));
$inlines = $query->execute();
->withRevisionPHIDs(array($revision->getPHID()))
->withPublishedComments(true)
->execute();
$inlines = mpull($inlines, 'newInlineCommentObject');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($revision_monogram, $revision_uri);

View file

@ -418,7 +418,8 @@ final class DiffusionCommitController extends DiffusionController {
$inlines = id(new DiffusionDiffInlineCommentQuery())
->setViewer($viewer)
->withCommitPHIDs(array($commit->getPHID()))
->withVisibleComments(true)
->withPublishedComments(true)
->withPublishableComments(true)
->execute();
$inlines = mpull($inlines, 'newInlineCommentObject');

View file

@ -103,7 +103,8 @@ final class DiffusionDiffController extends DiffusionController {
->setViewer($viewer)
->withCommitPHIDs(array($commit->getPHID()))
->withPathIDs(array($path_id))
->withVisibleComments(true)
->withPublishedComments(true)
->withPublishableComments(true)
->execute();
$inlines = mpull($inlines, 'newInlineCommentObject');

View file

@ -5,7 +5,7 @@ abstract class PhabricatorDiffInlineCommentQuery
private $fixedStates;
private $needReplyToComments;
private $visibleComments;
private $publishedComments;
private $publishableComments;
abstract protected function buildInlineCommentWhereClauseParts(
@ -22,13 +22,13 @@ abstract class PhabricatorDiffInlineCommentQuery
return $this;
}
public function withVisibleComments($with_visible) {
$this->visibleComments = $with_visible;
public function withPublishableComments($with_publishable) {
$this->publishableComments = $with_publishable;
return $this;
}
public function withPublishableComments($with_publishable) {
$this->publishableComments = $with_publishable;
public function withPublishedComments($with_published) {
$this->publishedComments = $with_published;
return $this;
}
@ -51,32 +51,30 @@ abstract class PhabricatorDiffInlineCommentQuery
$show_published = false;
$show_publishable = false;
if ($this->visibleComments !== null) {
if (!$this->visibleComments) {
throw new Exception(
pht(
'Querying for comments that are not visible is '.
'not supported.'));
}
$show_published = true;
$show_publishable = true;
}
if ($this->publishableComments !== null) {
if (!$this->publishableComments) {
throw new Exception(
pht(
'Querying for comments that are not publishable is '.
'Querying for comments that are "not publishable" is '.
'not supported.'));
}
$show_publishable = true;
}
if ($this->publishedComments !== null) {
if (!$this->publishedComments) {
throw new Exception(
pht(
'Querying for comments that are "not published" is '.
'not supported.'));
}
$show_published = true;
}
if ($show_publishable || $show_published) {
$clauses = array();
if ($show_published) {
// Published comments are always visible.
$clauses[] = qsprintf(
$conn,
'%T.transactionPHID IS NOT NULL',