Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
1.9 kB · 70 lines
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071<?php
final class ProjectAddProjectsEmailCommand extends MetaMTAEmailTransactionCommand {
public function getCommand() { return 'projects'; }
public function getCommandSyntax() { return '**!projects** //#project ...//'; }
public function getCommandSummary() { return pht('Add project tags.'); }
public function getCommandDescription() { return pht( 'Associate one or more projects to the object by listing their '. 'hashtags. Separate project tags with spaces. For example, use '. '`!projects #ios #feature` to add both related projects.'. "\n\n". 'Projects which are invalid or unrecognized will be ignored. This '. 'command has no effect if you do not specify any project tags.'); }
public function getCommandAliases() { return array( 'project', ); }
public function isCommandSupportedForObject( PhabricatorApplicationTransactionInterface $object) { return ($object instanceof PhabricatorProjectInterface); }
public function buildTransactions( PhabricatorUser $viewer, PhabricatorApplicationTransactionInterface $object, PhabricatorMetaMTAReceivedMail $mail, $command, array $argv) {
$project_phids = id(new PhabricatorObjectListQuery()) ->setViewer($viewer) ->setAllowedTypes( array( PhabricatorProjectProjectPHIDType::TYPECONST, )) ->setObjectList(implode(' ', $argv)) ->setAllowPartialResults(true) ->execute();
$xactions = array();
$type_project = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = $object->getApplicationTransactionTemplate() ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $type_project) ->setNewValue( array( '+' => array_fuse($project_phids), ));
return $xactions; }
}