2011-01-16 13:51:39 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialAction {
|
|
|
|
|
2012-04-23 17:40:57 -07:00
|
|
|
const ACTION_CLOSE = 'commit';
|
2011-01-16 13:51:39 -08:00
|
|
|
const ACTION_COMMENT = 'none';
|
|
|
|
const ACTION_ACCEPT = 'accept';
|
|
|
|
const ACTION_REJECT = 'reject';
|
2011-04-13 16:10:54 -07:00
|
|
|
const ACTION_RETHINK = 'rethink';
|
2011-01-16 13:51:39 -08:00
|
|
|
const ACTION_ABANDON = 'abandon';
|
|
|
|
const ACTION_REQUEST = 'request_review';
|
|
|
|
const ACTION_RECLAIM = 'reclaim';
|
|
|
|
const ACTION_UPDATE = 'update';
|
|
|
|
const ACTION_RESIGN = 'resign';
|
|
|
|
const ACTION_SUMMARIZE = 'summarize';
|
|
|
|
const ACTION_TESTPLAN = 'testplan';
|
|
|
|
const ACTION_CREATE = 'create';
|
|
|
|
const ACTION_ADDREVIEWERS = 'add_reviewers';
|
2011-06-24 12:21:48 -07:00
|
|
|
const ACTION_ADDCCS = 'add_ccs';
|
2012-04-17 14:59:31 -07:00
|
|
|
const ACTION_CLAIM = 'claim';
|
2013-01-19 09:10:15 -08:00
|
|
|
const ACTION_REOPEN = 'reopen';
|
2011-01-16 13:51:39 -08:00
|
|
|
|
2011-01-30 11:02:22 -08:00
|
|
|
public static function getActionPastTenseVerb($action) {
|
2012-06-14 19:18:05 -07:00
|
|
|
$verbs = array(
|
2011-01-16 13:51:39 -08:00
|
|
|
self::ACTION_COMMENT => 'commented on',
|
|
|
|
self::ACTION_ACCEPT => 'accepted',
|
|
|
|
self::ACTION_REJECT => 'requested changes to',
|
2011-04-13 16:10:54 -07:00
|
|
|
self::ACTION_RETHINK => 'planned changes to',
|
2011-01-16 13:51:39 -08:00
|
|
|
self::ACTION_ABANDON => 'abandoned',
|
2013-01-24 10:46:47 -08:00
|
|
|
self::ACTION_CLOSE => 'closed',
|
2011-01-16 13:51:39 -08:00
|
|
|
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',
|
2011-06-24 12:21:48 -07:00
|
|
|
self::ACTION_ADDCCS => 'added CCs to',
|
2012-04-17 14:59:31 -07:00
|
|
|
self::ACTION_CLAIM => 'commandeered',
|
2013-01-19 09:10:15 -08:00
|
|
|
self::ACTION_REOPEN => 'reopened',
|
2011-01-16 13:51:39 -08:00
|
|
|
);
|
|
|
|
|
2011-01-30 10:37:36 -08:00
|
|
|
if (!empty($verbs[$action])) {
|
2011-01-16 13:51:39 -08:00
|
|
|
return $verbs[$action];
|
|
|
|
} else {
|
|
|
|
return 'brazenly "'.$action.'ed"';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-30 11:02:22 -08:00
|
|
|
public static function getActionVerb($action) {
|
2013-01-24 10:46:47 -08:00
|
|
|
$verbs = array(
|
|
|
|
self::ACTION_COMMENT => pht('Comment'),
|
|
|
|
self::ACTION_ACCEPT => pht("Accept Revision \xE2\x9C\x94"),
|
|
|
|
self::ACTION_REJECT => pht("Request Changes \xE2\x9C\x98"),
|
|
|
|
self::ACTION_RETHINK => pht("Plan Changes \xE2\x9C\x98"),
|
|
|
|
self::ACTION_ABANDON => pht('Abandon Revision'),
|
|
|
|
self::ACTION_REQUEST => pht('Request Review'),
|
|
|
|
self::ACTION_RECLAIM => pht('Reclaim Revision'),
|
|
|
|
self::ACTION_RESIGN => pht('Resign as Reviewer'),
|
|
|
|
self::ACTION_ADDREVIEWERS => pht('Add Reviewers'),
|
|
|
|
self::ACTION_ADDCCS => pht('Add CCs'),
|
|
|
|
self::ACTION_CLOSE => pht('Close Revision'),
|
|
|
|
self::ACTION_CLAIM => pht('Commandeer Revision'),
|
|
|
|
self::ACTION_REOPEN => pht('Reopen'),
|
2011-01-30 11:02:22 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
if (!empty($verbs[$action])) {
|
|
|
|
return $verbs[$action];
|
|
|
|
} else {
|
|
|
|
return 'brazenly '.$action;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-20 14:11:11 -07:00
|
|
|
public static function allowReviewers($action) {
|
|
|
|
if ($action == DifferentialAction::ACTION_ADDREVIEWERS ||
|
2013-07-10 11:05:53 -07:00
|
|
|
$action == DifferentialAction::ACTION_REQUEST ||
|
|
|
|
$action == DifferentialAction::ACTION_RESIGN) {
|
2012-09-20 14:11:11 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-16 13:51:39 -08:00
|
|
|
}
|