1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Fix an issue where "Close Revision" did not appear in the UI

Summary:
Ref T2543. When called from the UI to build the dropdown, there's no Editor, since we aren't actually in an edit flow.

This logic worked for actually performing the edits, just not for getting the option into the dropdown.

Test Plan: Used the dropdown to close an "Accepted" revision which I authored.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18490
This commit is contained in:
epriestley 2017-08-29 09:54:03 -07:00
parent f3f671aa90
commit f49d103af5
2 changed files with 10 additions and 4 deletions

View file

@ -46,10 +46,12 @@ final class DifferentialRevisionCloseTransaction
}
protected function validateAction($object, PhabricatorUser $viewer) {
if ($this->getEditor()->getIsCloseByCommit()) {
// If we're closing a revision because we discovered a commit, we don't
// care what state it was in.
return;
if ($this->hasEditor()) {
if ($this->getEditor()->getIsCloseByCommit()) {
// If we're closing a revision because we discovered a commit, we don't
// care what state it was in.
return;
}
}
if ($object->isClosed()) {

View file

@ -134,6 +134,10 @@ abstract class PhabricatorModularTransactionType
return $this->editor;
}
final protected function hasEditor() {
return (bool)$this->editor;
}
final protected function getAuthorPHID() {
return $this->getStorage()->getAuthorPHID();
}