From 017125598631b394fd4bb05c52a0ad1180a42587 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 29 Aug 2017 09:54:03 -0700 Subject: [PATCH] (stable) 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 --- .../xaction/DifferentialRevisionCloseTransaction.php | 10 ++++++---- .../storage/PhabricatorModularTransactionType.php | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php b/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php index 8d01f48eff..d71b30950a 100644 --- a/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionCloseTransaction.php @@ -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()) { diff --git a/src/applications/transactions/storage/PhabricatorModularTransactionType.php b/src/applications/transactions/storage/PhabricatorModularTransactionType.php index 119bfedd32..f2b59c8a2b 100644 --- a/src/applications/transactions/storage/PhabricatorModularTransactionType.php +++ b/src/applications/transactions/storage/PhabricatorModularTransactionType.php @@ -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(); }