Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P927
example_priority_patch.diff
Active
Public
Actions
Authored by
epriestley
on Sep 18 2013, 6:09 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F58627: example_priority_patch.diff
Feb 24 2016, 1:31 AM
2016-02-24 01:31:54 (UTC+0)
Subscribers
None
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'))
Event Timeline
epriestley
edited the content of this paste.
(Show Details)
Sep 18 2013, 6:09 PM
2013-09-18 18:09:53 (UTC+0)
epriestley
changed the title of this paste from untitled to
example_priority_patch.diff
.
epriestley
updated the paste's language from
autodetect
to
autodetect
.
Log In to Comment