Page MenuHomePhabricator

D12246.diff
No OneTemporary

D12246.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3025,6 +3025,7 @@
'PonderVoteSaveController' => 'applications/ponder/controller/PonderVoteSaveController.php',
'PonderVotingUserHasAnswerEdgeType' => 'applications/ponder/edge/PonderVotingUserHasAnswerEdgeType.php',
'PonderVotingUserHasQuestionEdgeType' => 'applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php',
+ 'ProjectAddProjectsEmailCommand' => 'applications/project/command/ProjectAddProjectsEmailCommand.php',
'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php',
'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php',
'ProjectConduitAPIMethod' => 'applications/project/conduit/ProjectConduitAPIMethod.php',
@@ -6517,6 +6518,7 @@
'PonderVoteSaveController' => 'PonderController',
'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType',
'PonderVotingUserHasQuestionEdgeType' => 'PhabricatorEdgeType',
+ 'ProjectAddProjectsEmailCommand' => 'MetaMTAEmailTransactionCommand',
'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability',
'ProjectConduitAPIMethod' => 'ConduitAPIMethod',
'ProjectCreateConduitAPIMethod' => 'ProjectConduitAPIMethod',
diff --git a/src/applications/project/command/ProjectAddProjectsEmailCommand.php b/src/applications/project/command/ProjectAddProjectsEmailCommand.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/command/ProjectAddProjectsEmailCommand.php
@@ -0,0 +1,70 @@
+<?php
+
+final class ProjectAddProjectsEmailCommand
+ extends MetaMTAEmailTransactionCommand {
+
+ public function getCommand() {
+ return 'projects';
+ }
+
+ public function getCommandSyntax() {
+ return '**!projects** //#project ...//';
+ }
+
+ public function getCommandSummary() {
+ return pht('Add related projects.');
+ }
+
+ public function getCommandDescription() {
+ return pht(
+ 'Add one or more projects to the object by listing their hashtags. '.
+ 'Separate projects 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 projects.');
+ }
+
+ 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;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 9:00 AM (13 h, 26 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6913329
Default Alt Text
D12246.diff (3 KB)

Event Timeline