Skip to content

Commit

Permalink
Add a defaulty priority configuration flag for maniphest tasks
Browse files Browse the repository at this point in the history
Summary: instance-wide this setting be

Test Plan: made a new task and noted the default priority honored what was in btrahan.conf

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1842

Differential Revision: https://secure.phabricator.com/D3626
  • Loading branch information
bobtrahan committed Oct 4, 2012
1 parent ea32c54 commit 84ddc4a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions conf/default.conf.php
Expand Up @@ -1057,6 +1057,11 @@
// Adding Custom Fields" in the documentation for more information.
'maniphest.custom-task-extensions-class' => 'ManiphestDefaultTaskExtensions',

// What should the default task priority be in create flows?
// See the constants in @{class:ManiphestTaskPriority} for valid values.
// Defaults to "needs triage".
'maniphest.default-priority' => 90,

// -- Phriction ------------------------------------------------------------- //

'phriction.enabled' => true,
Expand Down
Expand Up @@ -42,7 +42,7 @@ public function defineErrorTypes() {

protected function execute(ConduitAPIRequest $request) {
$task = new ManiphestTask();
$task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
$task->setPriority(ManiphestTaskPriority::getDefaultPriority());
$task->setAuthorPHID($request->getUser()->getPHID());

$this->applyRequest($task, $request, $is_new = true);
Expand Down
1 change: 1 addition & 0 deletions src/applications/maniphest/ManiphestReplyHandler.php
Expand Up @@ -87,6 +87,7 @@ protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
$task->setAuthorPHID($user->getPHID());
$task->setTitle(nonempty($mail->getSubject(), 'Untitled Task'));
$task->setDescription($body);
$task->setPriority(ManiphestTaskPriority::getDefaultPriority());

} else {
$lines = explode("\n", trim($body));
Expand Down
12 changes: 12 additions & 0 deletions src/applications/maniphest/constants/ManiphestTaskPriority.php
Expand Up @@ -93,6 +93,17 @@ public static function getLowestPriority() {
public static function getHighestPriority() {
return self::PRIORITY_UNBREAK_NOW;
}
/**
* Return the default priority for this instance of Phabricator.
*
* @return int The value of the default priority constant.
*/
public static function getDefaultPriority() {
return PhabricatorEnv::getEnvConfig(
'maniphest.default-priority',
self::PRIORITY_TRIAGE
);
}

/**
* Retrieve the full name of the priority level provided.
Expand All @@ -104,4 +115,5 @@ public static function getHighestPriority() {
public static function getTaskPriorityName($priority) {
return idx(self::getTaskPriorityMap(), $priority, '???');
}

}
Expand Up @@ -43,7 +43,7 @@ public function processRequest() {
}
} else {
$task = new ManiphestTask();
$task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
$task->setPriority(ManiphestTaskPriority::getDefaultPriority());
$task->setAuthorPHID($user->getPHID());

// These allow task creation with defaults.
Expand Down

0 comments on commit 84ddc4a

Please sign in to comment.