[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/constants/ -> DifferentialAction.php (source)

   1  <?php
   2  
   3  final class DifferentialAction {
   4  
   5    const ACTION_CLOSE          = 'commit';
   6    const ACTION_COMMENT        = 'none';
   7    const ACTION_ACCEPT         = 'accept';
   8    const ACTION_REJECT         = 'reject';
   9    const ACTION_RETHINK        = 'rethink';
  10    const ACTION_ABANDON        = 'abandon';
  11    const ACTION_REQUEST        = 'request_review';
  12    const ACTION_RECLAIM        = 'reclaim';
  13    const ACTION_UPDATE         = 'update';
  14    const ACTION_RESIGN         = 'resign';
  15    const ACTION_SUMMARIZE      = 'summarize';
  16    const ACTION_TESTPLAN       = 'testplan';
  17    const ACTION_CREATE         = 'create';
  18    const ACTION_ADDREVIEWERS   = 'add_reviewers';
  19    const ACTION_ADDCCS         = 'add_ccs';
  20    const ACTION_CLAIM          = 'claim';
  21    const ACTION_REOPEN         = 'reopen';
  22  
  23    public static function getBasicStoryText($action, $author_name) {
  24      switch ($action) {
  25        case DifferentialAction::ACTION_COMMENT:
  26          $title = pht('%s commented on this revision.',
  27            $author_name);
  28          break;
  29        case DifferentialAction::ACTION_ACCEPT:
  30          $title = pht('%s accepted this revision.',
  31            $author_name);
  32          break;
  33        case DifferentialAction::ACTION_REJECT:
  34          $title = pht('%s requested changes to this revision.',
  35            $author_name);
  36          break;
  37        case DifferentialAction::ACTION_RETHINK:
  38          $title = pht('%s planned changes to this revision.',
  39            $author_name);
  40          break;
  41        case DifferentialAction::ACTION_ABANDON:
  42          $title = pht('%s abandoned this revision.',
  43            $author_name);
  44          break;
  45        case DifferentialAction::ACTION_CLOSE:
  46          $title = pht('%s closed this revision.',
  47            $author_name);
  48          break;
  49        case DifferentialAction::ACTION_REQUEST:
  50          $title = pht('%s requested a review of this revision.',
  51            $author_name);
  52          break;
  53        case DifferentialAction::ACTION_RECLAIM:
  54          $title = pht('%s reclaimed this revision.',
  55            $author_name);
  56          break;
  57        case DifferentialAction::ACTION_UPDATE:
  58          $title = pht('%s updated this revision.',
  59            $author_name);
  60          break;
  61        case DifferentialAction::ACTION_RESIGN:
  62          $title = pht('%s resigned from this revision.',
  63            $author_name);
  64          break;
  65        case DifferentialAction::ACTION_SUMMARIZE:
  66          $title = pht('%s summarized this revision.',
  67            $author_name);
  68          break;
  69        case DifferentialAction::ACTION_TESTPLAN:
  70          $title = pht('%s explained the test plan for this revision.',
  71            $author_name);
  72          break;
  73        case DifferentialAction::ACTION_CREATE:
  74          $title = pht('%s created this revision.',
  75            $author_name);
  76          break;
  77        case DifferentialAction::ACTION_ADDREVIEWERS:
  78          $title = pht('%s added reviewers to this revision.',
  79            $author_name);
  80          break;
  81        case DifferentialAction::ACTION_ADDCCS:
  82          $title = pht('%s added CCs to this revision.',
  83            $author_name);
  84          break;
  85        case DifferentialAction::ACTION_CLAIM:
  86          $title = pht('%s commandeered this revision.',
  87            $author_name);
  88          break;
  89        case DifferentialAction::ACTION_REOPEN:
  90          $title = pht('%s reopened this revision.',
  91            $author_name);
  92          break;
  93        case DifferentialTransaction::TYPE_INLINE:
  94          $title = pht(
  95            '%s added an inline comment.',
  96            $author_name);
  97          break;
  98        default:
  99          $title = pht('Ghosts happened to this revision.');
 100          break;
 101      }
 102      return $title;
 103    }
 104  
 105    public static function getActionVerb($action) {
 106      $verbs = array(
 107        self::ACTION_COMMENT        => pht('Comment'),
 108        self::ACTION_ACCEPT         => pht("Accept Revision \xE2\x9C\x94"),
 109        self::ACTION_REJECT         => pht("Request Changes \xE2\x9C\x98"),
 110        self::ACTION_RETHINK        => pht("Plan Changes \xE2\x9C\x98"),
 111        self::ACTION_ABANDON        => pht('Abandon Revision'),
 112        self::ACTION_REQUEST        => pht('Request Review'),
 113        self::ACTION_RECLAIM        => pht('Reclaim Revision'),
 114        self::ACTION_RESIGN         => pht('Resign as Reviewer'),
 115        self::ACTION_ADDREVIEWERS   => pht('Add Reviewers'),
 116        self::ACTION_ADDCCS         => pht('Add Subscribers'),
 117        self::ACTION_CLOSE          => pht('Close Revision'),
 118        self::ACTION_CLAIM          => pht('Commandeer Revision'),
 119        self::ACTION_REOPEN         => pht('Reopen'),
 120      );
 121  
 122      if (!empty($verbs[$action])) {
 123        return $verbs[$action];
 124      } else {
 125        return 'brazenly '.$action;
 126      }
 127    }
 128  
 129    public static function allowReviewers($action) {
 130      if ($action == DifferentialAction::ACTION_ADDREVIEWERS ||
 131          $action == DifferentialAction::ACTION_REQUEST ||
 132          $action == DifferentialAction::ACTION_RESIGN) {
 133        return true;
 134      }
 135      return false;
 136    }
 137  
 138  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1