1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Implement countdown.search and countdown.edit

Summary: adds new conduit methods for countdown.edit and countdown.search

Test Plan:
Search: {P2037}
Edit: {P2038}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12524

Differential Revision: https://secure.phabricator.com/D17679
This commit is contained in:
Austin McKinley 2017-04-13 12:17:18 -07:00
parent 4189eb810b
commit d902d2ac6b
4 changed files with 79 additions and 2 deletions

View file

@ -338,6 +338,8 @@ phutil_register_library_map(array(
'ConpherenceUpdateController' => 'applications/conpherence/controller/ConpherenceUpdateController.php',
'ConpherenceUpdateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php',
'ConpherenceViewController' => 'applications/conpherence/controller/ConpherenceViewController.php',
'CountdownEditConduitAPIMethod' => 'applications/countdown/conduit/CountdownEditConduitAPIMethod.php',
'CountdownSearchConduitAPIMethod' => 'applications/countdown/conduit/CountdownSearchConduitAPIMethod.php',
'DarkConsoleController' => 'applications/console/controller/DarkConsoleController.php',
'DarkConsoleCore' => 'applications/console/core/DarkConsoleCore.php',
'DarkConsoleDataController' => 'applications/console/controller/DarkConsoleDataController.php',
@ -5127,6 +5129,8 @@ phutil_register_library_map(array(
'ConpherenceUpdateController' => 'ConpherenceController',
'ConpherenceUpdateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceViewController' => 'ConpherenceController',
'CountdownEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'CountdownSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DarkConsoleController' => 'PhabricatorController',
'DarkConsoleCore' => 'Phobject',
'DarkConsoleDataController' => 'PhabricatorController',
@ -7513,6 +7517,7 @@ phutil_register_library_map(array(
'PhabricatorSpacesInterface',
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
'PhabricatorConduitResultInterface',
),
'PhabricatorCountdownApplication' => 'PhabricatorApplication',
'PhabricatorCountdownController' => 'PhabricatorController',

View file

@ -0,0 +1,18 @@
<?php
final class CountdownEditConduitAPIMethod
extends PhabricatorEditEngineAPIMethod {
public function getAPIMethodName() {
return 'countdown.edit';
}
public function newEditEngine() {
return new PhabricatorCountdownEditEngine();
}
public function getMethodSummary() {
return pht(
'Apply transactions to create a new countdown or edit an existing one.');
}
}

View file

@ -0,0 +1,18 @@
<?php
final class CountdownSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'countdown.search';
}
public function newSearchEngine() {
return new PhabricatorCountdownSearchEngine();
}
public function getMethodSummary() {
return pht('Read information about countdowns.');
}
}

View file

@ -9,7 +9,8 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
PhabricatorTokenReceiverInterface,
PhabricatorSpacesInterface,
PhabricatorProjectInterface,
PhabricatorDestructibleInterface {
PhabricatorDestructibleInterface,
PhabricatorConduitResultInterface {
protected $title;
protected $authorPHID;
@ -151,10 +152,45 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
PhabricatorDestructionEngine $engine) {
$this->openTransaction();
$this->delete();
$this->saveTransaction();
}
/* -( PhabricatorConduitResultInterface )---------------------------------- */
public function getFieldSpecificationsForConduit() {
return array(
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('title')
->setType('string')
->setDescription(pht('The title of the countdown.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('description')
->setType('remarkup')
->setDescription(pht('The description of the countdown.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('epoch')
->setType('epoch')
->setDescription(pht('The end date of the countdown.')),
);
}
public function getFieldValuesForConduit() {
return array(
'title' => $this->getTitle(),
'description' => array(
'raw' => $this->getDescription(),
),
'epoch' => (int)$this->getEpoch(),
);
}
public function getConduitSearchAttachments() {
return array();
}
}