diff --git a/resources/sql/autopatches/20150626.spaces.1.calendar.sql b/resources/sql/autopatches/20150626.spaces.1.calendar.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20150626.spaces.1.calendar.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_calendar.calendar_event + ADD spacePHID VARBINARY(64); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5124,6 +5124,7 @@ 'PhabricatorDestructibleInterface', 'PhabricatorMentionableInterface', 'PhabricatorFlaggableInterface', + 'PhabricatorSpacesInterface', ), 'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController', diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -158,6 +158,7 @@ $icon = $event->getIcon(); $edit_policy = $event->getEditPolicy(); $view_policy = $event->getViewPolicy(); + $space = $event->getSpacePHID(); if ($request->isFormPost()) { $xactions = array(); @@ -178,6 +179,7 @@ $subscribers = $request->getArr('subscribers'); $edit_policy = $request->getStr('editPolicy'); $view_policy = $request->getStr('viewPolicy'); + $space = $request->getStr('spacePHID'); $is_recurring = $request->getStr('isRecurring') ? 1 : 0; $frequency = $request->getStr('frequency'); $is_all_day = $request->getStr('isAllDay'); @@ -263,6 +265,10 @@ ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) ->setNewValue($request->getStr('editPolicy')); + $xactions[] = id(new PhabricatorCalendarEventTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_SPACE) + ->setNewValue($space); + $editor = id(new PhabricatorCalendarEventEditor()) ->setActor($viewer) ->setContentSourceFromRequest($request) @@ -471,6 +477,7 @@ ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setPolicyObject($event) ->setPolicies($current_policies) + ->setSpacePHID($space) ->setName('viewPolicy'); $edit_policies = id(new AphrontFormPolicyControl()) ->setUser($viewer) diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -9,7 +9,8 @@ PhabricatorTokenReceiverInterface, PhabricatorDestructibleInterface, PhabricatorMentionableInterface, - PhabricatorFlaggableInterface { + PhabricatorFlaggableInterface, + PhabricatorSpacesInterface { protected $name; protected $userPHID; @@ -32,6 +33,8 @@ protected $viewPolicy; protected $editPolicy; + protected $spacePHID; + const DEFAULT_ICON = 'fa-calendar'; private $parentEvent = self::ATTACHABLE; @@ -71,6 +74,7 @@ ->setIcon(self::DEFAULT_ICON) ->setViewPolicy($view_policy) ->setEditPolicy($actor->getPHID()) + ->setSpacePHID($actor->getDefaultSpacePHID()) ->attachInvitees(array()) ->applyViewerTimezone($actor); } @@ -551,4 +555,11 @@ $this->delete(); $this->saveTransaction(); } + +/* -( PhabricatorSpacesInterface )----------------------------------------- */ + + + public function getSpacePHID() { + return $this->spacePHID; + } } diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -107,6 +107,8 @@ $spaces_source = id(new PhabricatorSpacesNamespaceDatasource()) ->setViewer($viewer); + var_dump('asdf'); + require_celerity_resource('maniphest-batch-editor'); Javelin::initBehavior( 'maniphest-batch-editor',