Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18740562
D7394.id16666.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7394.id16666.diff
View Options
Index: src/applications/maniphest/controller/ManiphestTaskEditController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -49,9 +49,55 @@
$task->setTitle($request->getStr('title'));
if ($can_edit_projects) {
- $default_projects = $request->getStr('projects');
- if ($default_projects) {
- $task->setProjectPHIDs(explode(';', $default_projects));
+ $projects = $request->getStr('projects');
+ if ($projects) {
+ $tokens = explode(';', $projects);
+
+ $slug_map = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->requireCapabilities(
+ array(PhabricatorPolicyCapability::CAN_VIEW))
+ ->withPhrictionSlugs($tokens)
+ ->execute();
+
+ $name_map = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->requireCapabilities(
+ array(PhabricatorPolicyCapability::CAN_VIEW))
+ ->withNames($tokens)
+ ->execute();
+
+ $phid_map = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->requireCapabilities(
+ array(PhabricatorPolicyCapability::CAN_VIEW))
+ ->withPHIDs($tokens)
+ ->execute();
+
+ $all_map = mpull($slug_map, null, 'getPhrictionSlug') +
+ mpull($name_map, null, 'getName') +
+ mpull($phid_map, null, 'getPHID');
+
+ $default_projects = array();
+ foreach ($tokens as $token) {
+ if (isset($all_map[$token])) {
+ $default_projects[] = $all_map[$token]->getPHID();
+ }
+ }
+
+ if ($default_projects) {
+ $task->setProjectPHIDs($default_projects);
+ }
+ }
+ }
+
+ if ($can_edit_priority) {
+ $priority = $request->getInt('priority');
+ if ($priority !== null) {
+ $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
+ if (isset($priority_map[$priority])) {
+ $task->setPriority($priority);
+ }
}
}
Index: src/applications/project/query/PhabricatorProjectQuery.php
===================================================================
--- src/applications/project/query/PhabricatorProjectQuery.php
+++ src/applications/project/query/PhabricatorProjectQuery.php
@@ -7,6 +7,7 @@
private $phids;
private $memberPHIDs;
private $slugs;
+ private $names;
private $status = 'status-any';
const STATUS_ANY = 'status-any';
@@ -43,6 +44,11 @@
return $this;
}
+ public function withNames(array $names) {
+ $this->names = $names;
+ return $this;
+ }
+
public function needMembers($need_members) {
$this->needMembers = $need_members;
return $this;
@@ -224,6 +230,13 @@
$this->slugs);
}
+ if ($this->names) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'name IN (%Ls)',
+ $this->names);
+ }
+
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 3 2025, 4:00 AM (7 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12306638
Default Alt Text
D7394.id16666.diff (3 KB)
Attached To
Mode
D7394: Enable prefilling of projects and priority fields in Maniphest task creation
Attached
Detach File
Event Timeline
Log In to Comment