1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

Add missing needReviewerAuthority() for differential.createcomment

Summary: For some actions (like accept) we need to load reviewer authority so we can figure out if the actor can act on behalf of project reviewers, etc.

Test Plan: Will make @dctrwatson do it.

Reviewers: dctrwatson, btrahan

Reviewed By: btrahan

Subscribers: chad, aran, dctrwatson, epriestley

Differential Revision: https://secure.phabricator.com/D8505
This commit is contained in:
epriestley 2014-03-12 15:24:54 -07:00
parent 3b861ab741
commit 4173367f87
2 changed files with 2 additions and 31 deletions

View file

@ -37,6 +37,7 @@ final class ConduitAPI_differential_createcomment_Method
->setViewer($viewer)
->withIDs(array($request->getValue('revision_id')))
->needReviewerStatus(true)
->needReviewerAuthority(true)
->executeOne();
if (!$revision) {
throw new ConduitException('ERR_BAD_REVISION');
@ -45,7 +46,7 @@ final class ConduitAPI_differential_createcomment_Method
$xactions = array();
$action = $request->getValue('action');
if ($action && ($action != 'comment')) {
if ($action && ($action != 'comment') && ($action != 'none')) {
$xactions[] = id(new DifferentialTransaction())
->setTransactionType(DifferentialTransaction::TYPE_ACTION)
->setNewValue($action);

View file

@ -102,36 +102,6 @@ final class DifferentialAction {
return $title;
}
/* legacy, for just mail now */
public static function getActionPastTenseVerb($action) {
$verbs = array(
self::ACTION_COMMENT => 'commented on',
self::ACTION_ACCEPT => 'accepted',
self::ACTION_REJECT => 'requested changes to',
self::ACTION_RETHINK => 'planned changes to',
self::ACTION_ABANDON => 'abandoned',
self::ACTION_CLOSE => 'closed',
self::ACTION_REQUEST => 'requested a review of',
self::ACTION_RECLAIM => 'reclaimed',
self::ACTION_UPDATE => 'updated',
self::ACTION_RESIGN => 'resigned from',
self::ACTION_SUMMARIZE => 'summarized',
self::ACTION_TESTPLAN => 'explained the test plan for',
self::ACTION_CREATE => 'created',
self::ACTION_ADDREVIEWERS => 'added reviewers to',
self::ACTION_ADDCCS => 'added CCs to',
self::ACTION_CLAIM => 'commandeered',
self::ACTION_REOPEN => 'reopened',
DifferentialTransaction::TYPE_INLINE => 'commented on',
);
if (!empty($verbs[$action])) {
return $verbs[$action];
} else {
return 'brazenly "'.$action.'ed"';
}
}
public static function getActionVerb($action) {
$verbs = array(
self::ACTION_COMMENT => pht('Comment'),