mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +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:
parent
af5b94b234
commit
983d77848b
4 changed files with 25 additions and 24 deletions
|
@ -24,11 +24,12 @@ final class DifferentialRevisionInlinesController
|
||||||
$revision_uri = $revision->getURI();
|
$revision_uri = $revision->getURI();
|
||||||
$revision_title = $revision->getTitle();
|
$revision_title = $revision->getTitle();
|
||||||
|
|
||||||
$query = id(new DifferentialInlineCommentQuery())
|
$inlines = id(new DifferentialDiffInlineCommentQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->needHidden(true)
|
->withRevisionPHIDs(array($revision->getPHID()))
|
||||||
->withRevisionPHIDs(array($revision->getPHID()));
|
->withPublishedComments(true)
|
||||||
$inlines = $query->execute();
|
->execute();
|
||||||
|
$inlines = mpull($inlines, 'newInlineCommentObject');
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb($revision_monogram, $revision_uri);
|
$crumbs->addTextCrumb($revision_monogram, $revision_uri);
|
||||||
|
|
|
@ -418,7 +418,8 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withCommitPHIDs(array($commit->getPHID()))
|
->withCommitPHIDs(array($commit->getPHID()))
|
||||||
->withVisibleComments(true)
|
->withPublishedComments(true)
|
||||||
|
->withPublishableComments(true)
|
||||||
->execute();
|
->execute();
|
||||||
$inlines = mpull($inlines, 'newInlineCommentObject');
|
$inlines = mpull($inlines, 'newInlineCommentObject');
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,8 @@ final class DiffusionDiffController extends DiffusionController {
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withCommitPHIDs(array($commit->getPHID()))
|
->withCommitPHIDs(array($commit->getPHID()))
|
||||||
->withPathIDs(array($path_id))
|
->withPathIDs(array($path_id))
|
||||||
->withVisibleComments(true)
|
->withPublishedComments(true)
|
||||||
|
->withPublishableComments(true)
|
||||||
->execute();
|
->execute();
|
||||||
$inlines = mpull($inlines, 'newInlineCommentObject');
|
$inlines = mpull($inlines, 'newInlineCommentObject');
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ abstract class PhabricatorDiffInlineCommentQuery
|
||||||
|
|
||||||
private $fixedStates;
|
private $fixedStates;
|
||||||
private $needReplyToComments;
|
private $needReplyToComments;
|
||||||
private $visibleComments;
|
private $publishedComments;
|
||||||
private $publishableComments;
|
private $publishableComments;
|
||||||
|
|
||||||
abstract protected function buildInlineCommentWhereClauseParts(
|
abstract protected function buildInlineCommentWhereClauseParts(
|
||||||
|
@ -22,13 +22,13 @@ abstract class PhabricatorDiffInlineCommentQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withVisibleComments($with_visible) {
|
public function withPublishableComments($with_publishable) {
|
||||||
$this->visibleComments = $with_visible;
|
$this->publishableComments = $with_publishable;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withPublishableComments($with_publishable) {
|
public function withPublishedComments($with_published) {
|
||||||
$this->publishableComments = $with_publishable;
|
$this->publishedComments = $with_published;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,32 +51,30 @@ abstract class PhabricatorDiffInlineCommentQuery
|
||||||
$show_published = false;
|
$show_published = false;
|
||||||
$show_publishable = 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 !== null) {
|
||||||
if (!$this->publishableComments) {
|
if (!$this->publishableComments) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
pht(
|
pht(
|
||||||
'Querying for comments that are not publishable is '.
|
'Querying for comments that are "not publishable" is '.
|
||||||
'not supported.'));
|
'not supported.'));
|
||||||
}
|
}
|
||||||
$show_publishable = true;
|
$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) {
|
if ($show_publishable || $show_published) {
|
||||||
$clauses = array();
|
$clauses = array();
|
||||||
|
|
||||||
if ($show_published) {
|
if ($show_published) {
|
||||||
// Published comments are always visible.
|
|
||||||
$clauses[] = qsprintf(
|
$clauses[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'%T.transactionPHID IS NOT NULL',
|
'%T.transactionPHID IS NOT NULL',
|
||||||
|
|
Loading…
Reference in a new issue