mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
59a85e8845
Summary: Ref T4807. This is probably a complete fix, but I'd be surprised if there isn't a little cleanup I missed. When users drag tasks on a "natural"-ordered workboard, leave things where they put them. This isn't //too// bad since a lot of the existing work is completely reusable (e.g., we don't need any new JS). Test Plan: - Dragged a bunch of stuff around, it stayed where I put it after dropped and when reloaded. - Dragged stuff across priorities, no zany priority changes (in "natural" mode). - Created new tasks, they show up at the top. - Tagged new tasks, they show up at the top of backlog. - Swapped to "priority" mode and got sorting and the old priority-altering reordering. - Added tasks in priority mode. - Viewed task transactions for correctness/sanity. Reviewers: btrahan, chad Reviewed By: chad Subscribers: chad, epriestley Maniphest Tasks: T4807 Differential Revision: https://secure.phabricator.com/D10182
62 lines
1.5 KiB
PHP
62 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class PhabricatorProjectColumnPosition extends PhabricatorProjectDAO
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
protected $boardPHID;
|
|
protected $columnPHID;
|
|
protected $objectPHID;
|
|
protected $sequence;
|
|
|
|
private $column = self::ATTACHABLE;
|
|
|
|
public function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_TIMESTAMPS => false,
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function getColumn() {
|
|
return $this->assertAttached($this->column);
|
|
}
|
|
|
|
public function attachColumn(PhabricatorProjectColumn $column) {
|
|
$this->column = $column;
|
|
return $this;
|
|
}
|
|
|
|
public function getOrderingKey() {
|
|
// Low sequence numbers go above high sequence numbers.
|
|
// High position IDs go above low position IDs.
|
|
// Broadly, this makes newly added stuff float to the top.
|
|
|
|
return sprintf(
|
|
'~%012d%012d',
|
|
$this->getSequence(),
|
|
((1 << 31) - $this->getID()));
|
|
}
|
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
public function getCapabilities() {
|
|
return array(
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
);
|
|
}
|
|
|
|
public function getPolicy($capability) {
|
|
switch ($capability) {
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
return PhabricatorPolicies::getMostOpenPolicy();
|
|
}
|
|
}
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
return false;
|
|
}
|
|
|
|
public function describeAutomaticCapability($capability) {
|
|
return null;
|
|
}
|
|
|
|
}
|