Path: blob/master/src/applications/maniphest/command/ManiphestAssignEmailCommand.php
12256 views
<?php12final class ManiphestAssignEmailCommand3extends ManiphestEmailCommand {45public function getCommand() {6return 'assign';7}89public function getCommandSyntax() {10return '**!assign** //username//';11}1213public function getCommandSummary() {14return pht('Assign a task to a specific user.');15}1617public function getCommandDescription() {18return pht(19"To assign a task to another user, provide their username. For example, ".20"to assign a task to `%s`, write `%s`.\n\n".21"If you omit the username or the username is not valid, this behaves ".22"like `%s` and assigns the task to you instead.",23'alincoln',24'!assign alincoln',25'!claim');26}2728public function buildTransactions(29PhabricatorUser $viewer,30PhabricatorApplicationTransactionInterface $object,31PhabricatorMetaMTAReceivedMail $mail,32$command,33array $argv) {34$xactions = array();3536$assign_phid = null;3738$assign_to = head($argv);39if ($assign_to) {40$assign_user = id(new PhabricatorPeopleQuery())41->setViewer($viewer)42->withUsernames(array($assign_to))43->executeOne();44if ($assign_user) {45$assign_phid = $assign_user->getPHID();46}47}4849// Treat bad "!assign" like "!claim".50if (!$assign_phid) {51$assign_phid = $viewer->getPHID();52}5354$xactions[] = $object->getApplicationTransactionTemplate()55->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)56->setNewValue($assign_phid);5758return $xactions;59}6061}626364