mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Fix error cues on "Edit Revision" interface
Summary: The field hints on this interface don't behave correctly. Particularly, when you add yourself as a reviewer you aren't pointed at the issue. Test Plan: Edited a revision and tried to save invalid changes, including self-reviewership. Reviewers: moskov, jungejason, tuomaspelkonen, aran CC: Differential Revision: 565
This commit is contained in:
parent
553ef6f587
commit
2b8116d7ae
1 changed files with 7 additions and 0 deletions
|
@ -57,6 +57,7 @@ class DifferentialRevisionEditController extends DifferentialController {
|
|||
|
||||
$e_title = true;
|
||||
$e_testplan = true;
|
||||
$e_reviewers = null;
|
||||
$errors = array();
|
||||
|
||||
$revision->loadRelationships();
|
||||
|
@ -71,17 +72,22 @@ class DifferentialRevisionEditController extends DifferentialController {
|
|||
if (!strlen(trim($revision->getTitle()))) {
|
||||
$errors[] = 'You must provide a title.';
|
||||
$e_title = 'Required';
|
||||
} else {
|
||||
$e_title = null;
|
||||
}
|
||||
|
||||
if (!strlen(trim($revision->getTestPlan()))) {
|
||||
$errors[] = 'You must provide a test plan.';
|
||||
$e_testplan = 'Required';
|
||||
} else {
|
||||
$e_testplan = null;
|
||||
}
|
||||
|
||||
$user_phid = $request->getUser()->getPHID();
|
||||
|
||||
if (in_array($user_phid, $request->getArr('reviewers'))) {
|
||||
$errors[] = 'You may not review your own revision.';
|
||||
$e_reviewers = 'Invalid';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
|
@ -172,6 +178,7 @@ class DifferentialRevisionEditController extends DifferentialController {
|
|||
->setLabel('Reviewers')
|
||||
->setName('reviewers')
|
||||
->setDatasource('/typeahead/common/users/')
|
||||
->setError($e_reviewers)
|
||||
->setValue($reviewer_map))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
|
|
Loading…
Reference in a new issue