mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Replace "loadDraftComments()" with a Query
Summary: Ref T13513. Take another step toward coherent query pathways for inlines. Test Plan: - Created, previewed, and submitted inlines in Diffusion. - Got a (mostly) appropriate draft state. - Got proper comment peristence, preview behavior, and submission behavior. Maniphest Tasks: T13513 Differential Revision: https://secure.phabricator.com/D21229
This commit is contained in:
parent
d0593a5a78
commit
6c59db20a3
3 changed files with 11 additions and 29 deletions
|
@ -55,27 +55,6 @@ final class PhabricatorAuditInlineComment
|
|||
return head(self::buildProxies($inlines));
|
||||
}
|
||||
|
||||
public static function loadDraftComments(
|
||||
PhabricatorUser $viewer,
|
||||
$commit_phid,
|
||||
$raw = false) {
|
||||
|
||||
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||
->setViewer($viewer)
|
||||
->withAuthorPHIDs(array($viewer->getPHID()))
|
||||
->withCommitPHIDs(array($commit_phid))
|
||||
->withHasTransaction(false)
|
||||
->withIsDeleted(false)
|
||||
->needReplyToComments(true)
|
||||
->execute();
|
||||
|
||||
if ($raw) {
|
||||
return $inlines;
|
||||
}
|
||||
|
||||
return self::buildProxies($inlines);
|
||||
}
|
||||
|
||||
public static function loadPublishedComments(
|
||||
PhabricatorUser $viewer,
|
||||
$commit_phid) {
|
||||
|
|
|
@ -128,10 +128,12 @@ final class DiffusionCommitEditEngine
|
|||
$viewer = $this->getViewer();
|
||||
$xactions = array();
|
||||
|
||||
$inlines = PhabricatorAuditInlineComment::loadDraftComments(
|
||||
$viewer,
|
||||
$object->getPHID(),
|
||||
$raw = true);
|
||||
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($object->getPHID()))
|
||||
->withPublishableComments(true)
|
||||
->needReplyToComments(true)
|
||||
->execute();
|
||||
$inlines = msort($inlines, 'getID');
|
||||
|
||||
$editor = $object->getApplicationTransactionEditor()
|
||||
|
|
|
@ -7,10 +7,11 @@ final class DiffusionCommitDraftEngine
|
|||
$viewer = $this->getViewer();
|
||||
$commit = $this->getObject();
|
||||
|
||||
$inlines = PhabricatorAuditInlineComment::loadDraftComments(
|
||||
$viewer,
|
||||
$commit->getPHID(),
|
||||
$raw = true);
|
||||
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||
->setViewer($viewer)
|
||||
->withCommitPHIDs(array($commit->getPHID()))
|
||||
->withPublishableComments(true)
|
||||
->execute();
|
||||
|
||||
return (bool)$inlines;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue