mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +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('reviews', 'Reviews'),
|
||||
array('subscribed', 'Subscribed'),
|
||||
array('drafts', 'Draft Reviews'),
|
||||
array(null, 'All Revisions'),
|
||||
array('all', 'All'),
|
||||
);
|
||||
|
@ -248,6 +249,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
|||
'revisions' => true,
|
||||
'reviews' => true,
|
||||
'subscribed' => true,
|
||||
'drafts' => true,
|
||||
'all' => false,
|
||||
);
|
||||
if (!isset($requires[$filter])) {
|
||||
|
@ -262,6 +264,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
|||
'revisions' => true,
|
||||
'reviews' => true,
|
||||
'subscribed' => true,
|
||||
'drafts' => true,
|
||||
'all' => true,
|
||||
);
|
||||
if (!isset($allows[$filter])) {
|
||||
|
@ -276,6 +279,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
|||
'revisions' => array('phid', 'status', 'order'),
|
||||
'reviews' => array('phid', 'status', 'order'),
|
||||
'subscribed' => array('phid', 'status', 'order'),
|
||||
'drafts' => array('phid', 'status', 'order'),
|
||||
'all' => array('status', 'order'),
|
||||
);
|
||||
if (!isset($controls[$filter])) {
|
||||
|
@ -304,6 +308,9 @@ final class DifferentialRevisionListController extends DifferentialController {
|
|||
case 'subscribed':
|
||||
$query->withSubscribers(array($user_phid));
|
||||
break;
|
||||
case 'drafts':
|
||||
$query->withDraftRepliesByAuthors(array($user_phid));
|
||||
break;
|
||||
case 'all':
|
||||
break;
|
||||
default:
|
||||
|
@ -416,6 +423,7 @@ final class DifferentialRevisionListController extends DifferentialController {
|
|||
case 'revisions':
|
||||
case 'reviews':
|
||||
case 'subscribed':
|
||||
case 'drafts':
|
||||
case 'all':
|
||||
$titles = array(
|
||||
'revisions' => 'Revisions by Author',
|
||||
|
|
|
@ -42,6 +42,7 @@ final class DifferentialRevisionQuery {
|
|||
const STATUS_ABANDONED = 'status-abandoned';
|
||||
|
||||
private $authors = array();
|
||||
private $draftAuthors = array();
|
||||
private $ccs = array();
|
||||
private $reviewers = array();
|
||||
private $revIDs = array();
|
||||
|
@ -107,6 +108,18 @@ final class DifferentialRevisionQuery {
|
|||
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
|
||||
* function will clear anything set by previous calls to @{method:withCCs}.
|
||||
|
@ -561,6 +574,14 @@ final class DifferentialRevisionQuery {
|
|||
$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);
|
||||
|
||||
return $joins;
|
||||
|
@ -594,6 +615,12 @@ final class DifferentialRevisionQuery {
|
|||
$this->authors);
|
||||
}
|
||||
|
||||
if ($this->draftAuthors) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'inline_comment.authorPHID IN (%Ls)',
|
||||
$this->draftAuthors);
|
||||
}
|
||||
if ($this->revIDs) {
|
||||
$where[] = qsprintf(
|
||||
$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/diff');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/revision');
|
||||
phutil_require_module('phabricator', 'storage/qsprintf');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
|
Loading…
Reference in a new issue