Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F58627
example_priority_patch.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
epriestley
Sep 18 2013, 6:09 PM
2013-09-18 18:09:53 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
example_priority_patch.diff
View Options
diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php
index bf10fcf..2f6e942 100644
--- a/src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -81,6 +81,19 @@ final class ManiphestTaskEditController extends ManiphestController {
}
}
+ // Test if the user is a member of a hard-coded project with a given PHID.
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->withPHIDs(array('XXXX')) // <<< Change this!
+ ->withMemberPHIDs(array($user->getPHID()))
+ ->execute();
+
+ if ($project) {
+ $can_set_priority = true;
+ } else {
+ $can_set_priority = false;
+ }
+
$errors = array();
$e_title = true;
@@ -164,14 +177,18 @@ final class ManiphestTaskEditController extends ManiphestController {
}
if ($errors) {
- $task->setPriority($request->getInt('priority'));
+ if ($can_set_priority) {
+ $task->setPriority($request->getInt('priority'));
+ }
$task->setOwnerPHID($owner_phid);
$task->setCCPHIDs($request->getArr('cc'));
$task->setProjectPHIDs($request->getArr('projects'));
} else {
- if ($request->getInt('priority') != $task->getPriority()) {
- $changes[ManiphestTransactionType::TYPE_PRIORITY] =
- $request->getInt('priority');
+ if ($can_set_priority) {
+ if ($request->getInt('priority') != $task->getPriority()) {
+ $changes[ManiphestTransactionType::TYPE_PRIORITY] =
+ $request->getInt('priority');
+ }
}
if ($owner_phid != $task->getOwnerPHID()) {
@@ -465,13 +482,18 @@ final class ManiphestTaskEditController extends ManiphestController {
->setName('cc')
->setValue($cc_value)
->setUser($user)
- ->setDatasource('/typeahead/common/mailable/'))
- ->appendChild(
+ ->setDatasource('/typeahead/common/mailable/'));
+
+ if ($can_set_priority) {
+ $form->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Priority'))
->setName('priority')
->setOptions($priority_map)
- ->setValue($task->getPriority()))
+ ->setValue($task->getPriority()));
+ }
+
+ $form
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Projects'))
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/zx/o6/of72cl2zvaseugw3
Default Alt Text
example_priority_patch.diff (2 KB)
Attached To
Mode
P927 example_priority_patch.diff
Attached
Detach File
Event Timeline
Log In to Comment