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

Replace remaining pseudo-query methods on AuditInlineComment

Summary: Ref T13513. Another step closer to the light.

Test Plan: Created, edited, deleted, replied to, and submitted inline comments in Diffusion.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21230
This commit is contained in:
epriestley 2020-05-07 12:22:29 -07:00
parent 6c59db20a3
commit 949b9163d0
2 changed files with 22 additions and 45 deletions

View file

@ -34,49 +34,6 @@ final class PhabricatorAuditInlineComment
return $this->getStorageObject(); return $this->getStorageObject();
} }
public static function loadID($id) {
$inlines = id(new PhabricatorAuditTransactionComment())->loadAllWhere(
'id = %d',
$id);
if (!$inlines) {
return null;
}
return head(self::buildProxies($inlines));
}
public static function loadPHID($phid) {
$inlines = id(new PhabricatorAuditTransactionComment())->loadAllWhere(
'phid = %s',
$phid);
if (!$inlines) {
return null;
}
return head(self::buildProxies($inlines));
}
public static function loadPublishedComments(
PhabricatorUser $viewer,
$commit_phid) {
$inlines = id(new DiffusionDiffInlineCommentQuery())
->setViewer($viewer)
->withCommitPHIDs(array($commit_phid))
->withHasTransaction(true)
->execute();
return self::buildProxies($inlines);
}
private static function buildProxies(array $inlines) {
$results = array();
foreach ($inlines as $key => $inline) {
$results[$key] = self::newFromModernComment(
$inline);
}
return $results;
}
public static function newFromModernComment( public static function newFromModernComment(
PhabricatorAuditTransactionComment $comment) { PhabricatorAuditTransactionComment $comment) {

View file

@ -42,11 +42,31 @@ final class DiffusionInlineCommentController
} }
protected function loadComment($id) { protected function loadComment($id) {
return PhabricatorAuditInlineComment::loadID($id); $viewer = $this->getViewer();
$inline = id(new DiffusionDiffInlineCommentQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if ($inline) {
$inline = $inline->newInlineCommentObject();
}
return $inline;
} }
protected function loadCommentByPHID($phid) { protected function loadCommentByPHID($phid) {
return PhabricatorAuditInlineComment::loadPHID($phid); $viewer = $this->getViewer();
$inline = id(new DiffusionDiffInlineCommentQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
->executeOne();
if ($inline) {
$inline = $inline->newInlineCommentObject();
}
return $inline;
} }
protected function loadCommentForEdit($id) { protected function loadCommentForEdit($id) {