3 final class ManiphestStatusEmailCommand
4 extends ManiphestEmailCommand
{
6 public function getCommand() {
10 public function getCommandSyntax() {
11 return '**!status** //status//';
14 public function getCommandSummary() {
15 return pht('Change the status of a task.');
18 public function getCommandDescription() {
19 $names = ManiphestTaskStatus
::getTaskStatusMap();
20 $keywords = ManiphestTaskStatus
::getTaskStatusKeywordsMap();
23 $table[] = '| '.pht('Status').' | '.pht('Keywords');
24 $table[] = '|---|---|';
25 foreach ($keywords as $status => $words) {
26 if (ManiphestTaskStatus
::isDisabledStatus($status)) {
30 $words = implode(', ', $words);
31 $table[] = '| '.$names[$status].' | '.$words;
33 $table = implode("\n", $table);
36 "To change the status of a task, specify the desired status, like ".
37 "`%s`. This table shows the configured names for statuses.\n\n%s\n\n".
38 "If you specify an invalid status, the command is ignored. This ".
39 "command has no effect if you do not specify a status.\n\n".
40 "To quickly close a task, see `%s`.",
46 public function buildTransactions(
47 PhabricatorUser
$viewer,
48 PhabricatorApplicationTransactionInterface
$object,
49 PhabricatorMetaMTAReceivedMail
$mail,
54 $target = phutil_utf8_strtolower(head($argv));
57 $keywords = ManiphestTaskStatus
::getTaskStatusKeywordsMap();
58 foreach ($keywords as $key => $words) {
59 foreach ($words as $word) {
60 if ($word == $target) {
67 if ($status === null) {
71 if (ManiphestTaskStatus
::isDisabledStatus($status)) {
75 $xactions[] = $object->getApplicationTransactionTemplate()
76 ->setTransactionType(ManiphestTaskStatusTransaction
::TRANSACTIONTYPE
)
77 ->setNewValue($status);