mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42: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:
parent
f3f671aa90
commit
f49d103af5
2 changed files with 10 additions and 4 deletions
|
@ -46,11 +46,13 @@ final class DifferentialRevisionCloseTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validateAction($object, PhabricatorUser $viewer) {
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
||||||
|
if ($this->hasEditor()) {
|
||||||
if ($this->getEditor()->getIsCloseByCommit()) {
|
if ($this->getEditor()->getIsCloseByCommit()) {
|
||||||
// If we're closing a revision because we discovered a commit, we don't
|
// If we're closing a revision because we discovered a commit, we don't
|
||||||
// care what state it was in.
|
// care what state it was in.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($object->isClosed()) {
|
if ($object->isClosed()) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
|
|
|
@ -134,6 +134,10 @@ abstract class PhabricatorModularTransactionType
|
||||||
return $this->editor;
|
return $this->editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function hasEditor() {
|
||||||
|
return (bool)$this->editor;
|
||||||
|
}
|
||||||
|
|
||||||
final protected function getAuthorPHID() {
|
final protected function getAuthorPHID() {
|
||||||
return $this->getStorage()->getAuthorPHID();
|
return $this->getStorage()->getAuthorPHID();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue