mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 23:40:57 +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:
parent
6c59db20a3
commit
949b9163d0
2 changed files with 22 additions and 45 deletions
|
@ -34,49 +34,6 @@ final class PhabricatorAuditInlineComment
|
|||
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(
|
||||
PhabricatorAuditTransactionComment $comment) {
|
||||
|
||||
|
|
|
@ -42,11 +42,31 @@ final class DiffusionInlineCommentController
|
|||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue