1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 22:40: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:
epriestley 2016-04-07 12:10:56 -07:00
parent cdec319143
commit 0900ffe9cb
3 changed files with 48 additions and 11 deletions

View file

@ -74,4 +74,35 @@ final class PhabricatorCountdownQuery
return 'PhabricatorCountdownApplication'; 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(),
);
}
} }

View file

@ -30,20 +30,18 @@ final class PhabricatorCountdownSearchEngine
} }
protected function buildCustomSearchFields() { protected function buildCustomSearchFields() {
return array( return array(
id(new PhabricatorUsersSearchField()) id(new PhabricatorUsersSearchField())
->setLabel(pht('Authors')) ->setLabel(pht('Authors'))
->setKey('authorPHIDs') ->setKey('authorPHIDs')
->setAliases(array('author', 'authors')), ->setAliases(array('author', 'authors')),
id(new PhabricatorSearchCheckboxesField()) id(new PhabricatorSearchCheckboxesField())
->setKey('upcoming') ->setKey('upcoming')
->setOptions(array( ->setOptions(
array(
'upcoming' => pht('Show only upcoming countdowns.'), 'upcoming' => pht('Show only upcoming countdowns.'),
)), )),
); );
} }
protected function getURI($path) { protected function getURI($path) {

View file

@ -46,6 +46,14 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
'description' => 'text', 'description' => 'text',
'mailKey' => 'bytes20', 'mailKey' => 'bytes20',
), ),
self::CONFIG_KEY_SCHEMA => array(
'key_epoch' => array(
'columns' => array('epoch'),
),
'key_author' => array(
'columns' => array('authorPHID', 'epoch'),
),
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }