1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-28 07:28:20 +01:00
phorge-phorge/src/applications/differential/constants/DifferentialAction.php

85 lines
3.1 KiB
PHP
Raw Normal View History

<?php
final class DifferentialAction {
const ACTION_CLOSE = 'commit';
const ACTION_COMMENT = 'none';
const ACTION_ACCEPT = 'accept';
const ACTION_REJECT = 'reject';
const ACTION_RETHINK = 'rethink';
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';
const ACTION_ADDCCS = 'add_ccs';
const ACTION_CLAIM = 'claim';
const ACTION_REOPEN = 'reopen';
2011-01-30 11:02:22 -08:00
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',
);
if (!empty($verbs[$action])) {
return $verbs[$action];
} else {
return 'brazenly "'.$action.'ed"';
}
}
2011-01-30 11:02:22 -08:00
public static function getActionVerb($action) {
$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;
}
}
public static function allowReviewers($action) {
if ($action == DifferentialAction::ACTION_ADDREVIEWERS ||
$action == DifferentialAction::ACTION_REQUEST ||
$action == DifferentialAction::ACTION_RESIGN) {
return true;
}
return false;
}
}