2015-04-01 17:40:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialActionEmailCommand
|
|
|
|
extends MetaMTAEmailTransactionCommand {
|
|
|
|
|
|
|
|
private $command;
|
|
|
|
private $action;
|
|
|
|
private $aliases;
|
2015-04-01 16:36:16 +02:00
|
|
|
private $commandSummary;
|
|
|
|
private $commandDescription;
|
2015-04-01 17:40:12 +02:00
|
|
|
|
|
|
|
public function getCommand() {
|
|
|
|
return $this->command;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setCommand($command) {
|
|
|
|
$this->command = $command;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setAction($action) {
|
|
|
|
$this->action = $action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getAction() {
|
|
|
|
return $this->action;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function setCommandAliases(array $aliases) {
|
|
|
|
$this->aliases = $aliases;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommandAliases() {
|
|
|
|
return $this->aliases;
|
|
|
|
}
|
|
|
|
|
2015-04-01 16:36:16 +02:00
|
|
|
public function setCommandSummary($command_summary) {
|
|
|
|
$this->commandSummary = $command_summary;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommandSummary() {
|
|
|
|
return $this->commandSummary;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCommandDescription($command_description) {
|
|
|
|
$this->commandDescription = $command_description;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommandDescription() {
|
|
|
|
return $this->commandDescription;
|
|
|
|
}
|
|
|
|
|
2015-04-01 17:40:12 +02:00
|
|
|
public function getCommandObjects() {
|
2017-01-02 20:36:02 +01:00
|
|
|
$actions = DifferentialRevisionActionTransaction::loadAllActions();
|
|
|
|
$actions = msort($actions, 'getRevisionActionOrderVector');
|
2015-04-01 17:40:12 +02:00
|
|
|
|
|
|
|
$objects = array();
|
2017-01-02 20:36:02 +01:00
|
|
|
foreach ($actions as $action) {
|
|
|
|
$keyword = $action->getCommandKeyword();
|
|
|
|
if ($keyword === null) {
|
|
|
|
continue;
|
2015-04-01 17:40:12 +02:00
|
|
|
}
|
|
|
|
|
2017-01-02 20:36:02 +01:00
|
|
|
$aliases = $action->getCommandAliases();
|
|
|
|
$summary = $action->getCommandSummary();
|
|
|
|
|
|
|
|
$object = id(new self())
|
|
|
|
->setCommand($keyword)
|
|
|
|
->setCommandAliases($aliases)
|
|
|
|
->setAction($action->getTransactionTypeConstant())
|
|
|
|
->setCommandSummary($summary);
|
2015-04-01 16:36:16 +02:00
|
|
|
|
2015-04-01 17:40:12 +02:00
|
|
|
$objects[] = $object;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $objects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isCommandSupportedForObject(
|
|
|
|
PhabricatorApplicationTransactionInterface $object) {
|
|
|
|
return ($object instanceof DifferentialRevision);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildTransactions(
|
|
|
|
PhabricatorUser $viewer,
|
|
|
|
PhabricatorApplicationTransactionInterface $object,
|
|
|
|
PhabricatorMetaMTAReceivedMail $mail,
|
|
|
|
$command,
|
|
|
|
array $argv) {
|
|
|
|
$xactions = array();
|
|
|
|
|
|
|
|
$xactions[] = $object->getApplicationTransactionTemplate()
|
2017-01-02 20:36:02 +01:00
|
|
|
->setTransactionType($this->getAction())
|
|
|
|
->setNewValue(true);
|
2015-04-01 17:40:12 +02:00
|
|
|
|
|
|
|
return $xactions;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|