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));
|
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(
|
public static function loadPublishedComments(
|
||||||
PhabricatorUser $viewer,
|
PhabricatorUser $viewer,
|
||||||
$commit_phid) {
|
$commit_phid) {
|
||||||
|
|
|
@ -128,10 +128,12 @@ final class DiffusionCommitEditEngine
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
$inlines = PhabricatorAuditInlineComment::loadDraftComments(
|
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||||
$viewer,
|
->setViewer($viewer)
|
||||||
$object->getPHID(),
|
->withObjectPHIDs(array($object->getPHID()))
|
||||||
$raw = true);
|
->withPublishableComments(true)
|
||||||
|
->needReplyToComments(true)
|
||||||
|
->execute();
|
||||||
$inlines = msort($inlines, 'getID');
|
$inlines = msort($inlines, 'getID');
|
||||||
|
|
||||||
$editor = $object->getApplicationTransactionEditor()
|
$editor = $object->getApplicationTransactionEditor()
|
||||||
|
|
|
@ -7,10 +7,11 @@ final class DiffusionCommitDraftEngine
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$commit = $this->getObject();
|
$commit = $this->getObject();
|
||||||
|
|
||||||
$inlines = PhabricatorAuditInlineComment::loadDraftComments(
|
$inlines = id(new DiffusionDiffInlineCommentQuery())
|
||||||
$viewer,
|
->setViewer($viewer)
|
||||||
$commit->getPHID(),
|
->withCommitPHIDs(array($commit->getPHID()))
|
||||||
$raw = true);
|
->withPublishableComments(true)
|
||||||
|
->execute();
|
||||||
|
|
||||||
return (bool)$inlines;
|
return (bool)$inlines;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue