mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
Support sorting countdowns by end date
Summary: Fixes T5813, while I'm in here... Test Plan: Sorted stuff by end date. Reviewers: chad Reviewed By: chad Maniphest Tasks: T5813 Differential Revision: https://secure.phabricator.com/D15657
This commit is contained in:
parent
cdec319143
commit
0900ffe9cb
3 changed files with 48 additions and 11 deletions
|
@ -74,4 +74,35 @@ final class PhabricatorCountdownQuery
|
|||
return 'PhabricatorCountdownApplication';
|
||||
}
|
||||
|
||||
public function getBuiltinOrders() {
|
||||
return array(
|
||||
'ending' => array(
|
||||
'vector' => array('-epoch', '-id'),
|
||||
'name' => pht('End Date (Past to Future)'),
|
||||
),
|
||||
'unending' => array(
|
||||
'vector' => array('epoch', 'id'),
|
||||
'name' => pht('End Date (Future to Past)'),
|
||||
),
|
||||
) + parent::getBuiltinOrders();
|
||||
}
|
||||
|
||||
public function getOrderableColumns() {
|
||||
return array(
|
||||
'epoch' => array(
|
||||
'table' => $this->getPrimaryTableAlias(),
|
||||
'column' => 'epoch',
|
||||
'type' => 'int',
|
||||
),
|
||||
) + parent::getOrderableColumns();
|
||||
}
|
||||
|
||||
protected function getPagingValueMap($cursor, array $keys) {
|
||||
$countdown = $this->loadCursorObject($cursor);
|
||||
return array(
|
||||
'epoch' => $countdown->getEpoch(),
|
||||
'id' => $countdown->getID(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,20 +30,18 @@ final class PhabricatorCountdownSearchEngine
|
|||
}
|
||||
|
||||
protected function buildCustomSearchFields() {
|
||||
|
||||
return array(
|
||||
id(new PhabricatorUsersSearchField())
|
||||
->setLabel(pht('Authors'))
|
||||
->setKey('authorPHIDs')
|
||||
->setAliases(array('author', 'authors')),
|
||||
|
||||
id(new PhabricatorSearchCheckboxesField())
|
||||
->setKey('upcoming')
|
||||
->setOptions(array(
|
||||
id(new PhabricatorUsersSearchField())
|
||||
->setLabel(pht('Authors'))
|
||||
->setKey('authorPHIDs')
|
||||
->setAliases(array('author', 'authors')),
|
||||
id(new PhabricatorSearchCheckboxesField())
|
||||
->setKey('upcoming')
|
||||
->setOptions(
|
||||
array(
|
||||
'upcoming' => pht('Show only upcoming countdowns.'),
|
||||
)),
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
protected function getURI($path) {
|
||||
|
|
|
@ -46,6 +46,14 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
|||
'description' => 'text',
|
||||
'mailKey' => 'bytes20',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
'key_epoch' => array(
|
||||
'columns' => array('epoch'),
|
||||
),
|
||||
'key_author' => array(
|
||||
'columns' => array('authorPHID', 'epoch'),
|
||||
),
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue