diff --git a/src/applications/calendar/controller/PhabricatorCalendarController.php b/src/applications/calendar/controller/PhabricatorCalendarController.php index 6cba6d8fa7..9df28c8ddc 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarController.php @@ -61,6 +61,8 @@ abstract class PhabricatorCalendarController extends PhabricatorController { ->setID(null) ->setPHID(null) ->removeViewerTimezone($viewer) + ->setViewPolicy($event->getViewPolicy()) + ->setEditPolicy($event->getEditPolicy()) ->save(); $ghost_invitees = array(); foreach ($invitees as $invitee) { diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php index 68e119f2bd..d54643c786 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php @@ -156,11 +156,8 @@ final class PhabricatorCalendarEventEditController $is_parent = $event->getIsRecurrenceParent(); $frequency = idx($event->getRecurrenceFrequency(), 'rule'); $icon = $event->getIcon(); - - $current_policies = id(new PhabricatorPolicyQuery()) - ->setViewer($viewer) - ->setObject($event) - ->execute(); + $edit_policy = $event->getEditPolicy(); + $view_policy = $event->getViewPolicy(); if ($request->isFormPost()) { $xactions = array(); @@ -306,9 +303,6 @@ final class PhabricatorCalendarEventEditController PhabricatorCalendarEventTransaction::TYPE_END_DATE); $error_recurrence_end_date = $ex->getShortMessage( PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE); - - $event->setViewPolicy($view_policy); - $event->setEditPolicy($edit_policy); } } @@ -322,6 +316,11 @@ final class PhabricatorCalendarEventEditController $recurring_date_edit_label = null; + $current_policies = id(new PhabricatorPolicyQuery()) + ->setViewer($viewer) + ->setObject($event) + ->execute(); + $name = id(new AphrontFormTextControl()) ->setLabel(pht('Name')) ->setName('name') @@ -468,12 +467,14 @@ final class PhabricatorCalendarEventEditController $view_policies = id(new AphrontFormPolicyControl()) ->setUser($viewer) + ->setValue($view_policy) ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setPolicyObject($event) ->setPolicies($current_policies) ->setName('viewPolicy'); $edit_policies = id(new AphrontFormPolicyControl()) ->setUser($viewer) + ->setValue($edit_policy) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) ->setPolicyObject($event) ->setPolicies($current_policies)