mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Allow the users to view their unsubmitted inline comments in one view
Summary: 1. Created a filter for user comments that are not submitted yet 2. surface this information to the user by providing a "Draft revisions" link on the differential home page. Test Plan: tested on one of the diffs Reviewers: nh, epriestley Reviewed By: epriestley CC: aran, epriestley, jungejason Differential Revision: https://secure.phabricator.com/D1927
This commit is contained in:
parent
9a5598118e
commit
238b403509
3 changed files with 36 additions and 0 deletions
|
@ -219,6 +219,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
array('revisions', 'Revisions'),
|
array('revisions', 'Revisions'),
|
||||||
array('reviews', 'Reviews'),
|
array('reviews', 'Reviews'),
|
||||||
array('subscribed', 'Subscribed'),
|
array('subscribed', 'Subscribed'),
|
||||||
|
array('drafts', 'Draft Reviews'),
|
||||||
array(null, 'All Revisions'),
|
array(null, 'All Revisions'),
|
||||||
array('all', 'All'),
|
array('all', 'All'),
|
||||||
);
|
);
|
||||||
|
@ -248,6 +249,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
'revisions' => true,
|
'revisions' => true,
|
||||||
'reviews' => true,
|
'reviews' => true,
|
||||||
'subscribed' => true,
|
'subscribed' => true,
|
||||||
|
'drafts' => true,
|
||||||
'all' => false,
|
'all' => false,
|
||||||
);
|
);
|
||||||
if (!isset($requires[$filter])) {
|
if (!isset($requires[$filter])) {
|
||||||
|
@ -262,6 +264,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
'revisions' => true,
|
'revisions' => true,
|
||||||
'reviews' => true,
|
'reviews' => true,
|
||||||
'subscribed' => true,
|
'subscribed' => true,
|
||||||
|
'drafts' => true,
|
||||||
'all' => true,
|
'all' => true,
|
||||||
);
|
);
|
||||||
if (!isset($allows[$filter])) {
|
if (!isset($allows[$filter])) {
|
||||||
|
@ -276,6 +279,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
'revisions' => array('phid', 'status', 'order'),
|
'revisions' => array('phid', 'status', 'order'),
|
||||||
'reviews' => array('phid', 'status', 'order'),
|
'reviews' => array('phid', 'status', 'order'),
|
||||||
'subscribed' => array('phid', 'status', 'order'),
|
'subscribed' => array('phid', 'status', 'order'),
|
||||||
|
'drafts' => array('phid', 'status', 'order'),
|
||||||
'all' => array('status', 'order'),
|
'all' => array('status', 'order'),
|
||||||
);
|
);
|
||||||
if (!isset($controls[$filter])) {
|
if (!isset($controls[$filter])) {
|
||||||
|
@ -304,6 +308,9 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
case 'subscribed':
|
case 'subscribed':
|
||||||
$query->withSubscribers(array($user_phid));
|
$query->withSubscribers(array($user_phid));
|
||||||
break;
|
break;
|
||||||
|
case 'drafts':
|
||||||
|
$query->withDraftRepliesByAuthors(array($user_phid));
|
||||||
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -416,6 +423,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
||||||
case 'revisions':
|
case 'revisions':
|
||||||
case 'reviews':
|
case 'reviews':
|
||||||
case 'subscribed':
|
case 'subscribed':
|
||||||
|
case 'drafts':
|
||||||
case 'all':
|
case 'all':
|
||||||
$titles = array(
|
$titles = array(
|
||||||
'revisions' => 'Revisions by Author',
|
'revisions' => 'Revisions by Author',
|
||||||
|
|
|
@ -42,6 +42,7 @@ final class DifferentialRevisionQuery {
|
||||||
const STATUS_ABANDONED = 'status-abandoned';
|
const STATUS_ABANDONED = 'status-abandoned';
|
||||||
|
|
||||||
private $authors = array();
|
private $authors = array();
|
||||||
|
private $draftAuthors = array();
|
||||||
private $ccs = array();
|
private $ccs = array();
|
||||||
private $reviewers = array();
|
private $reviewers = array();
|
||||||
private $revIDs = array();
|
private $revIDs = array();
|
||||||
|
@ -107,6 +108,18 @@ final class DifferentialRevisionQuery {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter results to revisions with comments authored bythe given PHIDs
|
||||||
|
*
|
||||||
|
* @param array List of PHIDs of authors
|
||||||
|
* @return this
|
||||||
|
* @task config
|
||||||
|
*/
|
||||||
|
public function withDraftRepliesByAuthors(array $author_phids) {
|
||||||
|
$this->draftAuthors = $author_phids;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter results to revisions which CC one of the listed people. Calling this
|
* Filter results to revisions which CC one of the listed people. Calling this
|
||||||
* function will clear anything set by previous calls to @{method:withCCs}.
|
* function will clear anything set by previous calls to @{method:withCCs}.
|
||||||
|
@ -561,6 +574,14 @@ final class DifferentialRevisionQuery {
|
||||||
$this->responsibles);
|
$this->responsibles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
$joins = implode(' ', $joins);
|
$joins = implode(' ', $joins);
|
||||||
|
|
||||||
return $joins;
|
return $joins;
|
||||||
|
@ -594,6 +615,12 @@ final class DifferentialRevisionQuery {
|
||||||
$this->authors);
|
$this->authors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->draftAuthors) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn_r,
|
||||||
|
'inline_comment.authorPHID IN (%Ls)',
|
||||||
|
$this->draftAuthors);
|
||||||
|
}
|
||||||
if ($this->revIDs) {
|
if ($this->revIDs) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
|
|
|
@ -11,6 +11,7 @@ phutil_require_module('arcanist', 'differential/constants/revisionstatus');
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/affectedpath');
|
phutil_require_module('phabricator', 'applications/differential/storage/affectedpath');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
||||||
|
phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
||||||
phutil_require_module('phabricator', 'storage/qsprintf');
|
phutil_require_module('phabricator', 'storage/qsprintf');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
|
|
Loading…
Reference in a new issue