Remove "DifferentialInlineCommentQuery"

Summary: Ref T13513. Replaces "DifferentialInlineCommentQuery" with the similar but more modern "DifferentialDiffInlineCommentQuery".

Test Plan: Viewed comments in timeline, changesets. Created, edited, and submitted comments. Hid and un-hid comments, reloading (saw state preserved).

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21233
This commit is contained in:
epriestley
2020-05-07 13:17:56 -07:00
parent 983d77848b
commit 79107574a7
8 changed files with 138 additions and 180 deletions

View File

@@ -7,31 +7,40 @@ abstract class PhabricatorDiffInlineCommentQuery
private $needReplyToComments;
private $publishedComments;
private $publishableComments;
private $needHidden;
abstract protected function buildInlineCommentWhereClauseParts(
AphrontDatabaseConnection $conn);
abstract public function withObjectPHIDs(array $phids);
abstract protected function loadHiddenCommentIDs(
$viewer_phid,
array $comments);
public function withFixedStates(array $states) {
final public function withFixedStates(array $states) {
$this->fixedStates = $states;
return $this;
}
public function needReplyToComments($need_reply_to) {
final public function needReplyToComments($need_reply_to) {
$this->needReplyToComments = $need_reply_to;
return $this;
}
public function withPublishableComments($with_publishable) {
final public function withPublishableComments($with_publishable) {
$this->publishableComments = $with_publishable;
return $this;
}
public function withPublishedComments($with_published) {
final public function withPublishedComments($with_published) {
$this->publishedComments = $with_published;
return $this;
}
final public function needHidden($need_hidden) {
$this->needHidden = $need_hidden;
return $this;
}
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
$alias = $this->getPrimaryTableAlias();
@@ -152,6 +161,27 @@ abstract class PhabricatorDiffInlineCommentQuery
}
}
if (!$comments) {
return $comments;
}
if ($this->needHidden) {
$viewer = $this->getViewer();
$viewer_phid = $viewer->getPHID();
if ($viewer_phid) {
$hidden = $this->loadHiddenCommentIDs(
$viewer_phid,
$comments);
} else {
$hidden = array();
}
foreach ($comments as $inline) {
$inline->attachIsHidden(isset($hidden[$inline->getID()]));
}
}
return $comments;
}