Differential D18819 Diff 45159 src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionRequestReviewTransaction.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | protected function validateAction($object, PhabricatorUser $viewer) { | ||||
if ($object->isClosed()) { | if ($object->isClosed()) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'You can not request review of this revision because it has '. | 'You can not request review of this revision because it has '. | ||||
'already been closed. You can only request review of open '. | 'already been closed. You can only request review of open '. | ||||
'revisions.')); | 'revisions.')); | ||||
} | } | ||||
// When revisions automatically promote out of "Draft" after builds finish, | |||||
// the viewer may be acting as the Harbormaster application. | |||||
if (!$viewer->isOmnipotent()) { | |||||
if (!$this->isViewerRevisionAuthor($object, $viewer)) { | if (!$this->isViewerRevisionAuthor($object, $viewer)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'You can not request review of this revision because you are not '. | 'You can not request review of this revision because you are not '. | ||||
'the author of the revision.')); | 'the author of the revision.')); | ||||
} | } | ||||
} | } | ||||
} | |||||
public function getTitle() { | public function getTitle() { | ||||
return pht( | return pht( | ||||
'%s requested review of this revision.', | '%s requested review of this revision.', | ||||
$this->renderAuthor()); | $this->renderAuthor()); | ||||
} | } | ||||
public function getTitleForFeed() { | public function getTitleForFeed() { | ||||
return pht( | return pht( | ||||
'%s requested review of %s.', | '%s requested review of %s.', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderObject()); | $this->renderObject()); | ||||
} | } | ||||
} | } |