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
|
|
|
|
2014-02-09 10:07:29 -08:00
|
|
|
public static function getBasicStoryText($action, $author_name) {
|
|
|
|
switch ($action) {
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_COMMENT:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s commented on this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_ACCEPT:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s accepted this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_REJECT:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s requested changes to this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_RETHINK:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s planned changes to this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_ABANDON:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s abandoned this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_CLOSE:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s closed this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_REQUEST:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s requested a review of this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_RECLAIM:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s reclaimed this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_UPDATE:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s updated this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_RESIGN:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s resigned from this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_SUMMARIZE:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s summarized this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_TESTPLAN:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s explained the test plan for this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_CREATE:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s created this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_ADDREVIEWERS:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s added reviewers to this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_ADDCCS:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s added CCs to this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_CLAIM:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s commandeered this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
2015-05-14 06:50:28 +10:00
|
|
|
case self::ACTION_REOPEN:
|
2014-09-12 10:12:52 -07:00
|
|
|
$title = pht('%s reopened this revision.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
|
|
|
case DifferentialTransaction::TYPE_INLINE:
|
|
|
|
$title = pht(
|
|
|
|
'%s added an inline comment.',
|
|
|
|
$author_name);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$title = pht('Ghosts happened to this revision.');
|
|
|
|
break;
|
|
|
|
}
|
2014-02-09 10:07:29 -08:00
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
|
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'),
|
2014-06-03 15:53:52 -07:00
|
|
|
self::ACTION_ADDCCS => pht('Add Subscribers'),
|
2013-01-24 10:46:47 -08:00
|
|
|
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) {
|
2015-05-14 06:50:28 +10:00
|
|
|
if ($action == self::ACTION_ADDREVIEWERS ||
|
|
|
|
$action == self::ACTION_REQUEST ||
|
|
|
|
$action == self::ACTION_RESIGN) {
|
2012-09-20 14:11:11 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-16 13:51:39 -08:00
|
|
|
}
|