mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +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 $responsibles = array();
|
||||||
private $branches = array();
|
private $branches = array();
|
||||||
private $arcanistProjectPHIDs = array();
|
private $arcanistProjectPHIDs = array();
|
||||||
|
private $draftRevisions = array();
|
||||||
|
|
||||||
private $order = 'order-modified';
|
private $order = 'order-modified';
|
||||||
const ORDER_MODIFIED = 'order-modified';
|
const ORDER_MODIFIED = 'order-modified';
|
||||||
|
@ -483,6 +484,20 @@ final class DifferentialRevisionQuery {
|
||||||
$table = new DifferentialRevision();
|
$table = new DifferentialRevision();
|
||||||
$conn_r = $table->establishConnection('r');
|
$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(
|
$select = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'SELECT r.* FROM %T r',
|
'SELECT r.* FROM %T r',
|
||||||
|
@ -587,9 +602,11 @@ final class DifferentialRevisionQuery {
|
||||||
if ($this->draftAuthors) {
|
if ($this->draftAuthors) {
|
||||||
$joins[] = qsprintf(
|
$joins[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'JOIN %T inline_comment ON inline_comment.revisionID = r.id '.
|
'LEFT JOIN %T inline_comment ON inline_comment.revisionID = r.id '.
|
||||||
'AND inline_comment.commentID is NULL',
|
'AND inline_comment.commentID IS NULL '.
|
||||||
id(new DifferentialInlineComment())->getTableName());
|
'AND inline_comment.authorPHID IN (%Ls)',
|
||||||
|
id(new DifferentialInlineComment())->getTableName(),
|
||||||
|
$this->draftAuthors);
|
||||||
}
|
}
|
||||||
|
|
||||||
$joins = implode(' ', $joins);
|
$joins = implode(' ', $joins);
|
||||||
|
@ -626,10 +643,15 @@ final class DifferentialRevisionQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->draftAuthors) {
|
if ($this->draftAuthors) {
|
||||||
$where[] = qsprintf(
|
$condition = 'inline_comment.id IS NOT NULL';
|
||||||
$conn_r,
|
if ($this->draftRevisions) {
|
||||||
'inline_comment.authorPHID IN (%Ls)',
|
$condition = qsprintf(
|
||||||
$this->draftAuthors);
|
$conn_r,
|
||||||
|
'(%Q OR r.id IN (%Ld))',
|
||||||
|
$condition,
|
||||||
|
$this->draftRevisions);
|
||||||
|
}
|
||||||
|
$where[] = $condition;
|
||||||
}
|
}
|
||||||
if ($this->revIDs) {
|
if ($this->revIDs) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
|
|
Loading…
Reference in a new issue