From 8ade91486cfc643e0373fd31f6f32227fe592423 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 13 Jul 2016 08:39:42 -0700 Subject: [PATCH] Add `calendar.event.search` and `calendar.event.edit` Summary: Ref T7944. The search method is a bit bare-bones for now, but these substantially work. Test Plan: Edited events via API; queried events via API. Reviewers: chad Reviewed By: chad Maniphest Tasks: T7944 Differential Revision: https://secure.phabricator.com/D16288 --- src/__phutil_library_map__.php | 9 +++- ...catorCalendarEventEditConduitAPIMethod.php | 19 +++++++ ...torCalendarEventSearchConduitAPIMethod.php | 18 +++++++ ...PhabricatorCalendarEventEditController.php | 2 +- ...PhabricatorCalendarEventListController.php | 2 +- ...PhabricatorCalendarEventViewController.php | 2 +- ...=> PhabricatorCalendarEventEditEngine.php} | 2 +- .../storage/PhabricatorCalendarEvent.php | 52 +++++++++++++++---- 8 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 src/applications/calendar/conduit/PhabricatorCalendarEventEditConduitAPIMethod.php create mode 100644 src/applications/calendar/conduit/PhabricatorCalendarEventSearchConduitAPIMethod.php rename src/applications/calendar/editor/{PhabricatorCalendarEditEngine.php => PhabricatorCalendarEventEditEngine.php} (99%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 08c682de12..8397f72e1d 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2019,7 +2019,6 @@ phutil_register_library_map(array( 'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php', 'PhabricatorCalendarController' => 'applications/calendar/controller/PhabricatorCalendarController.php', 'PhabricatorCalendarDAO' => 'applications/calendar/storage/PhabricatorCalendarDAO.php', - 'PhabricatorCalendarEditEngine' => 'applications/calendar/editor/PhabricatorCalendarEditEngine.php', 'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php', 'PhabricatorCalendarEventAcceptTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventAcceptTransaction.php', 'PhabricatorCalendarEventAllDayTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventAllDayTransaction.php', @@ -2029,7 +2028,9 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventDeclineTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventDeclineTransaction.php', 'PhabricatorCalendarEventDescriptionTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventDescriptionTransaction.php', 'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php', + 'PhabricatorCalendarEventEditConduitAPIMethod' => 'applications/calendar/conduit/PhabricatorCalendarEventEditConduitAPIMethod.php', 'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php', + 'PhabricatorCalendarEventEditEngine' => 'applications/calendar/editor/PhabricatorCalendarEventEditEngine.php', 'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php', 'PhabricatorCalendarEventEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventEmailCommand.php', 'PhabricatorCalendarEventEndDateTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventEndDateTransaction.php', @@ -2048,6 +2049,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventRSVPEmailCommand' => 'applications/calendar/command/PhabricatorCalendarEventRSVPEmailCommand.php', 'PhabricatorCalendarEventRecurringTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventRecurringTransaction.php', 'PhabricatorCalendarEventReplyTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventReplyTransaction.php', + 'PhabricatorCalendarEventSearchConduitAPIMethod' => 'applications/calendar/conduit/PhabricatorCalendarEventSearchConduitAPIMethod.php', 'PhabricatorCalendarEventSearchEngine' => 'applications/calendar/query/PhabricatorCalendarEventSearchEngine.php', 'PhabricatorCalendarEventStartDateTransaction' => 'applications/calendar/xaction/PhabricatorCalendarEventStartDateTransaction.php', 'PhabricatorCalendarEventTransaction' => 'applications/calendar/storage/PhabricatorCalendarEventTransaction.php', @@ -6630,7 +6632,6 @@ phutil_register_library_map(array( 'PhabricatorCalendarApplication' => 'PhabricatorApplication', 'PhabricatorCalendarController' => 'PhabricatorController', 'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO', - 'PhabricatorCalendarEditEngine' => 'PhabricatorEditEngine', 'PhabricatorCalendarEvent' => array( 'PhabricatorCalendarDAO', 'PhabricatorPolicyInterface', @@ -6644,6 +6645,7 @@ phutil_register_library_map(array( 'PhabricatorFlaggableInterface', 'PhabricatorSpacesInterface', 'PhabricatorFulltextInterface', + 'PhabricatorConduitResultInterface', ), 'PhabricatorCalendarEventAcceptTransaction' => 'PhabricatorCalendarEventReplyTransaction', 'PhabricatorCalendarEventAllDayTransaction' => 'PhabricatorCalendarEventTransactionType', @@ -6653,7 +6655,9 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventDeclineTransaction' => 'PhabricatorCalendarEventReplyTransaction', 'PhabricatorCalendarEventDescriptionTransaction' => 'PhabricatorCalendarEventTransactionType', 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController', + 'PhabricatorCalendarEventEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', + 'PhabricatorCalendarEventEditEngine' => 'PhabricatorEditEngine', 'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorCalendarEventEmailCommand' => 'MetaMTAEmailTransactionCommand', 'PhabricatorCalendarEventEndDateTransaction' => 'PhabricatorCalendarEventDateTransaction', @@ -6675,6 +6679,7 @@ phutil_register_library_map(array( 'PhabricatorCalendarEventRSVPEmailCommand' => 'PhabricatorCalendarEventEmailCommand', 'PhabricatorCalendarEventRecurringTransaction' => 'PhabricatorCalendarEventTransactionType', 'PhabricatorCalendarEventReplyTransaction' => 'PhabricatorCalendarEventTransactionType', + 'PhabricatorCalendarEventSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'PhabricatorCalendarEventSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorCalendarEventStartDateTransaction' => 'PhabricatorCalendarEventDateTransaction', 'PhabricatorCalendarEventTransaction' => 'PhabricatorModularTransaction', diff --git a/src/applications/calendar/conduit/PhabricatorCalendarEventEditConduitAPIMethod.php b/src/applications/calendar/conduit/PhabricatorCalendarEventEditConduitAPIMethod.php new file mode 100644 index 0000000000..4f9e50f19a --- /dev/null +++ b/src/applications/calendar/conduit/PhabricatorCalendarEventEditConduitAPIMethod.php @@ -0,0 +1,19 @@ +setController($this) ->buildResponse(); } diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventListController.php b/src/applications/calendar/controller/PhabricatorCalendarEventListController.php index 529c206e7b..a2915b0be9 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventListController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventListController.php @@ -27,7 +27,7 @@ final class PhabricatorCalendarEventListController protected function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); - id(new PhabricatorCalendarEditEngine()) + id(new PhabricatorCalendarEventEditEngine()) ->setViewer($this->getViewer()) ->addActionToCrumbs($crumbs); diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php index 6c771cda31..b66943db33 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php @@ -38,7 +38,7 @@ final class PhabricatorCalendarEventViewController $details = $this->buildPropertySection($event); $description = $this->buildDescriptionView($event); - $comment_view = id(new PhabricatorCalendarEditEngine()) + $comment_view = id(new PhabricatorCalendarEventEditEngine()) ->setViewer($viewer) ->buildEditEngineCommentView($event); diff --git a/src/applications/calendar/editor/PhabricatorCalendarEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php similarity index 99% rename from src/applications/calendar/editor/PhabricatorCalendarEditEngine.php rename to src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php index 75772d5141..c53bb823ab 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEditEngine.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php @@ -1,6 +1,6 @@ setKey('name') + ->setType('string') + ->setDescription(pht('The name of the event.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('description') + ->setType('string') + ->setDescription(pht('The event description.')), + ); + } + + public function getFieldValuesForConduit() { + return array( + 'name' => $this->getName(), + 'description' => $this->getDescription(), + ); + } + + public function getConduitSearchAttachments() { + return array(); + } + }