2011-02-08 19:53:59 +01:00
|
|
|
<?php
|
|
|
|
|
2011-07-04 22:04:22 +02:00
|
|
|
/**
|
|
|
|
* @group maniphest
|
|
|
|
*/
|
2012-10-10 19:18:23 +02:00
|
|
|
final class ManiphestTransactionEditor extends PhabricatorEditor {
|
2011-02-08 19:53:59 +01:00
|
|
|
|
2011-05-16 21:31:18 +02:00
|
|
|
public function buildReplyHandler(ManiphestTask $task) {
|
2012-03-21 22:48:58 +01:00
|
|
|
$handler_object = PhabricatorEnv::newObjectFromConfig(
|
2011-05-10 01:31:26 +02:00
|
|
|
'metamta.maniphest.reply-handler');
|
|
|
|
$handler_object->setMailReceiver($task);
|
|
|
|
|
|
|
|
return $handler_object;
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|
2011-12-17 22:27:11 +01:00
|
|
|
|
2012-04-02 21:12:04 +02:00
|
|
|
public static function getNextSubpriority($pri, $sub) {
|
|
|
|
|
2013-09-25 22:44:14 +02:00
|
|
|
// TODO: T603 Figure out what the policies here should be once this gets
|
|
|
|
// cleaned up.
|
|
|
|
|
2012-04-02 21:12:04 +02:00
|
|
|
if ($sub === null) {
|
|
|
|
$next = id(new ManiphestTask())->loadOneWhere(
|
|
|
|
'priority = %d ORDER BY subpriority ASC LIMIT 1',
|
|
|
|
$pri);
|
|
|
|
if ($next) {
|
|
|
|
return $next->getSubpriority() - ((double)(2 << 16));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$next = id(new ManiphestTask())->loadOneWhere(
|
|
|
|
'priority = %d AND subpriority > %s ORDER BY subpriority ASC LIMIT 1',
|
|
|
|
$pri,
|
|
|
|
$sub);
|
|
|
|
if ($next) {
|
|
|
|
return ($sub + $next->getSubpriority()) / 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (double)(2 << 32);
|
|
|
|
}
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|