mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 03:02:43 +01:00
a9e98e42f5
Summary: Ref T10010. See D15174. This gets rid of the "actually apply the change" callsite and moves it to layout engine. Next up is to make the board view use the layout engine, then throw away all the whack code in ColumnPositionQuery, then move forward with D15171. Test Plan: - Dragged tasks within a column. - Dragged tasks between columns. - Dragged tasks to empty columns. - Created a task in a column. - Swapped board to priority sort, dragged a bunch of stuff all over. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10010 Differential Revision: https://secure.phabricator.com/D15175
81 lines
2 KiB
PHP
81 lines
2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorProjectColumnPosition extends PhabricatorProjectDAO
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
protected $boardPHID;
|
|
protected $columnPHID;
|
|
protected $objectPHID;
|
|
protected $sequence;
|
|
|
|
private $column = self::ATTACHABLE;
|
|
|
|
protected function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_TIMESTAMPS => false,
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'sequence' => 'uint32',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'boardPHID' => array(
|
|
'columns' => array('boardPHID', 'columnPHID', 'objectPHID'),
|
|
'unique' => true,
|
|
),
|
|
'objectPHID' => array(
|
|
'columns' => array('objectPHID', 'boardPHID'),
|
|
),
|
|
'boardPHID_2' => array(
|
|
'columns' => array('boardPHID', 'columnPHID', 'sequence'),
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function getColumn() {
|
|
return $this->assertAttached($this->column);
|
|
}
|
|
|
|
public function attachColumn(PhabricatorProjectColumn $column) {
|
|
$this->column = $column;
|
|
return $this;
|
|
}
|
|
|
|
public function getOrderingKey() {
|
|
if (!$this->getID() && !$this->getSequence()) {
|
|
return 0;
|
|
}
|
|
|
|
// 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;
|
|
}
|
|
|
|
}
|