mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Include comment drafts in revision draft query
Summary: Previously, only inline comment drafts were included. Test Plan: **/differential/** - verified that there are drafts where they weren't before. Checked executed queries. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3615
This commit is contained in:
parent
12df076157
commit
a185b1b4a7
1 changed files with 29 additions and 7 deletions
|
@ -54,6 +54,7 @@ final class DifferentialRevisionQuery {
|
|||
private $responsibles = array();
|
||||
private $branches = array();
|
||||
private $arcanistProjectPHIDs = array();
|
||||
private $draftRevisions = array();
|
||||
|
||||
private $order = 'order-modified';
|
||||
const ORDER_MODIFIED = 'order-modified';
|
||||
|
@ -483,6 +484,20 @@ final class DifferentialRevisionQuery {
|
|||
$table = new DifferentialRevision();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
|
||||
if ($this->draftAuthors) {
|
||||
$draft_key = 'differential-comment-';
|
||||
$drafts = id(new PhabricatorDraft())->loadAllWhere(
|
||||
'authorPHID IN (%Ls) AND draftKey LIKE %> AND draft != %s',
|
||||
$this->draftAuthors,
|
||||
$draft_key,
|
||||
'');
|
||||
$this->draftRevisions = array();
|
||||
$len = strlen($draft_key);
|
||||
foreach ($drafts as $draft) {
|
||||
$this->draftRevisions[] = substr($draft->getDraftKey(), $len);
|
||||
}
|
||||
}
|
||||
|
||||
$select = qsprintf(
|
||||
$conn_r,
|
||||
'SELECT r.* FROM %T r',
|
||||
|
@ -587,9 +602,11 @@ final class DifferentialRevisionQuery {
|
|||
if ($this->draftAuthors) {
|
||||
$joins[] = qsprintf(
|
||||
$conn_r,
|
||||
'JOIN %T inline_comment ON inline_comment.revisionID = r.id '.
|
||||
'AND inline_comment.commentID is NULL',
|
||||
id(new DifferentialInlineComment())->getTableName());
|
||||
'LEFT JOIN %T inline_comment ON inline_comment.revisionID = r.id '.
|
||||
'AND inline_comment.commentID IS NULL '.
|
||||
'AND inline_comment.authorPHID IN (%Ls)',
|
||||
id(new DifferentialInlineComment())->getTableName(),
|
||||
$this->draftAuthors);
|
||||
}
|
||||
|
||||
$joins = implode(' ', $joins);
|
||||
|
@ -626,10 +643,15 @@ final class DifferentialRevisionQuery {
|
|||
}
|
||||
|
||||
if ($this->draftAuthors) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'inline_comment.authorPHID IN (%Ls)',
|
||||
$this->draftAuthors);
|
||||
$condition = 'inline_comment.id IS NOT NULL';
|
||||
if ($this->draftRevisions) {
|
||||
$condition = qsprintf(
|
||||
$conn_r,
|
||||
'(%Q OR r.id IN (%Ld))',
|
||||
$condition,
|
||||
$this->draftRevisions);
|
||||
}
|
||||
$where[] = $condition;
|
||||
}
|
||||
if ($this->revIDs) {
|
||||
$where[] = qsprintf(
|
||||
|
|
Loading…
Reference in a new issue