Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15375384
D9457.id23693.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9457.id23693.diff
View Options
diff --git a/src/workflow/ArcanistTodoWorkflow.php b/src/workflow/ArcanistTodoWorkflow.php
--- a/src/workflow/ArcanistTodoWorkflow.php
+++ b/src/workflow/ArcanistTodoWorkflow.php
@@ -35,15 +35,19 @@
return true;
}
-
public function getArguments() {
return array(
'*' => 'summary',
'cc' => array(
- 'param' => 'cc',
- 'short' => 'C',
+ 'param' => 'cc',
+ 'short' => 'C',
+ 'repeat' => true,
+ 'help' => pht('Other users to CC on the new task.'),
+ ),
+ 'project' => array(
+ 'param' => 'project',
'repeat' => true,
- 'help' => 'Other users to CC on the new task.',
+ 'help' => pht('Projects to assign to the task.'),
),
);
}
@@ -51,6 +55,8 @@
public function run() {
$summary = implode(' ', $this->getArgument('summary'));
$ccs = $this->getArgument('cc');
+ $slugs = $this->getArgument('project');
+
$conduit = $this->getConduit();
if (trim($summary) == '') {
@@ -60,7 +66,7 @@
$args = array(
'title' => $summary,
- 'ownerPHID' => $this->getUserPHID()
+ 'ownerPHID' => $this->getUserPHID(),
);
if ($ccs) {
@@ -68,7 +74,7 @@
$users = $conduit->callMethodSynchronous(
'user.query',
array(
- 'usernames' => $ccs
+ 'usernames' => $ccs,
));
foreach ($users as $user => $info) {
$phids[] = $info['phid'];
@@ -76,10 +82,27 @@
$args['ccPHIDs'] = $phids;
}
- $result = $conduit->callMethodSynchronous(
- 'maniphest.createtask',
- $args);
+ if ($slugs) {
+ $phids = array();
+ $projects = $conduit->callMethodSynchronous(
+ 'project.query',
+ array(
+ 'slugs' => $slugs,
+ ));
+
+ foreach ($slugs as $slug) {
+ $project = idx($projects['slugMap'], $slug);
+
+ if (!$project) {
+ throw new ArcanistUsageException('No such project: "'.$slug.'"');
+ }
+ $phids[] = $project;
+ }
+
+ $args['projectPHIDs'] = $phids;
+ }
+ $result = $conduit->callMethodSynchronous('maniphest.createtask', $args);
echo phutil_console_format(
"Created task T%s: '<fg:green>**%s**</fg>' at <fg:blue>**%s**</fg>\n",
$result['id'],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 13, 10:52 PM (1 w, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7635586
Default Alt Text
D9457.id23693.diff (2 KB)
Attached To
Mode
D9457: Allow the `todo` workflow to add project tags.
Attached
Detach File
Event Timeline
Log In to Comment