Page MenuHomePhabricator

D8358.diff
No OneTemporary

D8358.diff

Index: src/applications/maniphest/controller/ManiphestSubpriorityController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestSubpriorityController.php
+++ src/applications/maniphest/controller/ManiphestSubpriorityController.php
@@ -41,28 +41,18 @@
$after_sub = null;
}
- $new_sub = ManiphestTransactionEditor::getNextSubpriority(
- $after_pri,
- $after_sub);
-
- $task->setSubpriority($new_sub);
-
- if ($after_pri != $task->getPriority()) {
- $xactions = array();
- $xactions[] = id(new ManiphestTransaction())
- ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
- ->setNewValue($after_pri);
-
- $editor = id(new ManiphestTransactionEditor())
- ->setActor($user)
- ->setContinueOnMissingFields(true)
- ->setContinueOnNoEffect(true)
- ->setContentSourceFromRequest($request);
-
- $editor->applyTransactions($task, $xactions);
- } else {
- $task->save();
- }
+ $xactions = array(id(new ManiphestTransaction())
+ ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
+ ->setNewValue(array(
+ 'newPriority' => $after_pri,
+ 'newSubpriorityBase' => $after_sub)));
+ $editor = id(new ManiphestTransactionEditor())
+ ->setActor($user)
+ ->setContinueOnMissingFields(true)
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request);
+
+ $editor->applyTransactions($task, $xactions);
return id(new AphrontAjaxResponse())->setContent(
array(
Index: src/applications/maniphest/editor/ManiphestTransactionEditor.php
===================================================================
--- src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -16,6 +16,7 @@
$types[] = ManiphestTransaction::TYPE_PROJECTS;
$types[] = ManiphestTransaction::TYPE_ATTACH;
$types[] = ManiphestTransaction::TYPE_EDGE;
+ $types[] = ManiphestTransaction::TYPE_SUBPRIORITY;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
@@ -58,6 +59,8 @@
case ManiphestTransaction::TYPE_EDGE:
// These are pre-populated.
return $xaction->getOldValue();
+ case ManiphestTransaction::TYPE_SUBPRIORITY:
+ return $object->getSubpriority();
}
}
@@ -79,6 +82,7 @@
case ManiphestTransaction::TYPE_DESCRIPTION:
case ManiphestTransaction::TYPE_ATTACH:
case ManiphestTransaction::TYPE_EDGE:
+ case ManiphestTransaction::TYPE_SUBPRIORITY:
return $xaction->getNewValue();
}
}
@@ -102,7 +106,6 @@
return parent::transactionHasEffect($object, $xaction);
}
-
protected function applyCustomInternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
@@ -147,10 +150,39 @@
// These are a weird, funky mess and are already being applied by the
// time we reach this.
return;
+ case ManiphestTransaction::TYPE_SUBPRIORITY:
+ $data = $xaction->getNewValue();
+ $new_sub = $this->getNextSubpriority(
+ $data['newPriority'],
+ $data['newSubpriorityBase']);
+ $object->setSubpriority($new_sub);
+ return;
}
}
+ protected function expandTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ $xactions = parent::expandTransaction($object, $xaction);
+ switch ($xaction->getTransactionType()) {
+ case ManiphestTransaction::TYPE_SUBPRIORITY:
+ $data = $xaction->getNewValue();
+ $new_pri = $data['newPriority'];
+ if ($new_pri != $object->getPriority()) {
+ $xactions[] = id(new ManiphestTransaction())
+ ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
+ ->setNewValue($new_pri);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return $xactions;
+ }
+
protected function applyCustomExternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
@@ -159,7 +191,19 @@
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {
- return true;
+ $should_mail = true;
+ if (count($xactions) == 1) {
+ $xaction = head($xactions);
+ switch ($xaction->getTransactionType()) {
+ case ManiphestTransaction::TYPE_SUBPRIORITY:
+ $should_mail = false;
+ break;
+ default:
+ $should_mail = true;
+ break;
+ }
+ }
+ return $should_mail;
}
protected function getMailSubjectPrefix() {
@@ -305,10 +349,7 @@
}
- public static function getNextSubpriority($pri, $sub) {
-
- // TODO: T603 Figure out what the policies here should be once this gets
- // cleaned up.
+ private function getNextSubpriority($pri, $sub) {
if ($sub === null) {
$next = id(new ManiphestTask())->loadOneWhere(
Index: src/applications/maniphest/storage/ManiphestTransaction.php
===================================================================
--- src/applications/maniphest/storage/ManiphestTransaction.php
+++ src/applications/maniphest/storage/ManiphestTransaction.php
@@ -12,6 +12,7 @@
const TYPE_PRIORITY = 'priority';
const TYPE_EDGE = 'edge';
const TYPE_ATTACH = 'attach';
+ const TYPE_SUBPRIORITY = 'subpriority';
public function getApplicationName() {
return 'maniphest';
@@ -85,6 +86,8 @@
return false;
}
break;
+ case self::TYPE_SUBPRIORITY:
+ return true;
}
return false;
Index: src/applications/project/controller/PhabricatorProjectBoardController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectBoardController.php
+++ src/applications/project/controller/PhabricatorProjectBoardController.php
@@ -96,8 +96,10 @@
foreach ($columns as $column) {
$panel = id(new PHUIWorkpanelView())
->setHeader($column->getDisplayName())
- ->setHeaderColor($column->getHeaderColor())
- ->setEditURI('edit/'.$column->getID().'/');
+ ->setHeaderColor($column->getHeaderColor());
+ if (!$column->isDefaultColumn()) {
+ $panel->setEditURI('edit/'.$column->getID().'/');
+ }
$cards = id(new PHUIObjectItemListView())
->setUser($viewer)
Index: src/applications/project/controller/PhabricatorProjectMoveController.php
===================================================================
--- src/applications/project/controller/PhabricatorProjectMoveController.php
+++ src/applications/project/controller/PhabricatorProjectMoveController.php
@@ -72,8 +72,31 @@
$column_phid,
$edge_phids);
- // TODO: We also need to deal with priorities, so far this only gets stuff
- // in the correct column.
+ if ($after_phid) {
+ $after_task = id(new ManiphestTaskQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($after_phid))
+ ->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))
+ ->executeOne();
+ if (!$after_task) {
+ return new Aphront404Response();
+ }
+ $after_pri = $after_task->getPriority();
+ $after_sub = $after_task->getSubpriority();
+
+ $xactions = array(id(new ManiphestTransaction())
+ ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
+ ->setNewValue(array(
+ 'newPriority' => $after_pri,
+ 'newSubpriorityBase' => $after_sub)));
+ $editor = id(new ManiphestTransactionEditor())
+ ->setActor($viewer)
+ ->setContinueOnMissingFields(true)
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request);
+
+ $editor->applyTransactions($object, $xactions);
+ }
return id(new AphrontAjaxResponse())->setContent(array());
}
Index: src/view/phui/PHUIWorkpanelView.php
===================================================================
--- src/view/phui/PHUIWorkpanelView.php
+++ src/view/phui/PHUIWorkpanelView.php
@@ -53,15 +53,20 @@
$footer_tag);
}
- $header_edit = id(new PHUIIconView())
- ->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
- ->setSpriteIcon('settings-grey')
- ->setHref($this->editURI);
+ $header_edit = null;
+ if ($this->editURI) {
+ $header_edit = id(new PHUIIconView())
+ ->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
+ ->setSpriteIcon('settings-grey')
+ ->setHref($this->editURI);
+ }
$header = id(new PhabricatorActionHeaderView())
->setHeaderTitle($this->header)
- ->setHeaderColor($this->headerColor)
- ->addAction($header_edit);
+ ->setHeaderColor($this->headerColor);
+ if ($header_edit) {
+ $header->addAction($header_edit);
+ }
$body = phutil_tag(
'div',

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 1, 1:08 PM (21 h, 13 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7079717
Default Alt Text
D8358.diff (8 KB)

Event Timeline