Abstract access to DifferentialInlineComment behind a Query
Summary: Ref T2222. See D6260. Push all this junk behind a Query so I can move the storage out from underneath it. Test Plan: Viewed home page, list view, revision. Made draft, looked at preview, submitted draft, viewed inline, replied to inline. Reviewers: btrahan Reviewed By: btrahan CC: chad, aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D6262
This commit is contained in:
@@ -268,10 +268,9 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
||||
return;
|
||||
}
|
||||
|
||||
return id(new DifferentialInlineComment())->loadAllWhere(
|
||||
'changesetID IN (%Ld) AND (commentID IS NOT NULL OR authorPHID = %s)',
|
||||
$changeset_ids,
|
||||
$author_phid);
|
||||
return id(new DifferentialInlineCommentQuery())
|
||||
->withAuthorAndChangesetIDs($author_phid, $changeset_ids)
|
||||
->execute();
|
||||
}
|
||||
|
||||
private function buildRawFileResponse(
|
||||
|
||||
@@ -39,10 +39,9 @@ final class DifferentialCommentSaveController extends DifferentialController {
|
||||
->setAddedCCs($ccs)
|
||||
->save();
|
||||
} catch (DifferentialActionHasNoEffectException $no_effect) {
|
||||
$has_inlines = id(new DifferentialInlineComment())->loadAllWhere(
|
||||
'authorPHID = %s AND revisionID = %d AND commentID IS NULL',
|
||||
$request->getUser()->getPHID(),
|
||||
$revision->getID());
|
||||
$has_inlines = id(new DifferentialInlineCommentQuery())
|
||||
->withDraftComments($request->getUser()->getPHID(), $revision->getID())
|
||||
->execute();
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($request->getUser());
|
||||
|
||||
@@ -29,7 +29,9 @@ final class DifferentialInlineCommentEditController
|
||||
}
|
||||
|
||||
protected function loadComment($id) {
|
||||
return id(new DifferentialInlineComment())->load($id);
|
||||
return id(new DifferentialInlineCommentQuery())
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
}
|
||||
|
||||
protected function loadCommentForEdit($id) {
|
||||
|
||||
@@ -12,10 +12,9 @@ extends PhabricatorInlineCommentPreviewController {
|
||||
protected function loadInlineComments() {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$inlines = id(new DifferentialInlineComment())->loadAllWhere(
|
||||
'authorPHID = %s AND revisionID = %d AND commentID IS NULL',
|
||||
$user->getPHID(),
|
||||
$this->revisionID);
|
||||
$inlines = id(new DifferentialInlineCommentQuery())
|
||||
->withDraftComments($user->getPHID(), $this->revisionID)
|
||||
->execute();
|
||||
|
||||
return $inlines;
|
||||
}
|
||||
|
||||
@@ -194,12 +194,9 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
pht('Show All Files Inline'))));
|
||||
$warning = $warning->render();
|
||||
|
||||
$my_inlines = id(new DifferentialInlineComment())->loadAllWhere(
|
||||
'revisionID = %d AND commentID IS NULL AND authorPHID = %s AND '.
|
||||
'changesetID IN (%Ld)',
|
||||
$this->revisionID,
|
||||
$user->getPHID(),
|
||||
mpull($changesets, 'getID'));
|
||||
$my_inlines = id(new DifferentialInlineCommentQuery())
|
||||
->withDraftComments($user->getPHID(), $this->revisionID)
|
||||
->execute();
|
||||
|
||||
$visible_changesets = array();
|
||||
foreach ($inlines + $my_inlines as $inline) {
|
||||
@@ -643,10 +640,9 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
return $inline_comments;
|
||||
}
|
||||
|
||||
$inline_comments = id(new DifferentialInlineComment())
|
||||
->loadAllWhere(
|
||||
'commentID in (%Ld)',
|
||||
$comment_ids);
|
||||
$inline_comments = id(new DifferentialInlineCommentQuery())
|
||||
->withCommentIDs($comment_ids)
|
||||
->execute();
|
||||
|
||||
$load_changesets = array();
|
||||
foreach ($inline_comments as $inline) {
|
||||
|
||||
Reference in New Issue
Block a user