1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Set event policies like other event properties

Summary: Closes T8028, Set event policies like other event properties

Test Plan: Create and edit events, make sure edit and view policies get populated and saved correctly.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T8028

Differential Revision: https://secure.phabricator.com/D13415
This commit is contained in:
lkassianik 2015-06-26 10:41:26 -07:00
parent cee1835bb0
commit b1a843b21a
2 changed files with 11 additions and 8 deletions

View file

@ -61,6 +61,8 @@ abstract class PhabricatorCalendarController extends PhabricatorController {
->setID(null) ->setID(null)
->setPHID(null) ->setPHID(null)
->removeViewerTimezone($viewer) ->removeViewerTimezone($viewer)
->setViewPolicy($event->getViewPolicy())
->setEditPolicy($event->getEditPolicy())
->save(); ->save();
$ghost_invitees = array(); $ghost_invitees = array();
foreach ($invitees as $invitee) { foreach ($invitees as $invitee) {

View file

@ -156,11 +156,8 @@ final class PhabricatorCalendarEventEditController
$is_parent = $event->getIsRecurrenceParent(); $is_parent = $event->getIsRecurrenceParent();
$frequency = idx($event->getRecurrenceFrequency(), 'rule'); $frequency = idx($event->getRecurrenceFrequency(), 'rule');
$icon = $event->getIcon(); $icon = $event->getIcon();
$edit_policy = $event->getEditPolicy();
$current_policies = id(new PhabricatorPolicyQuery()) $view_policy = $event->getViewPolicy();
->setViewer($viewer)
->setObject($event)
->execute();
if ($request->isFormPost()) { if ($request->isFormPost()) {
$xactions = array(); $xactions = array();
@ -306,9 +303,6 @@ final class PhabricatorCalendarEventEditController
PhabricatorCalendarEventTransaction::TYPE_END_DATE); PhabricatorCalendarEventTransaction::TYPE_END_DATE);
$error_recurrence_end_date = $ex->getShortMessage( $error_recurrence_end_date = $ex->getShortMessage(
PhabricatorCalendarEventTransaction::TYPE_RECURRENCE_END_DATE); 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; $recurring_date_edit_label = null;
$current_policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($event)
->execute();
$name = id(new AphrontFormTextControl()) $name = id(new AphrontFormTextControl())
->setLabel(pht('Name')) ->setLabel(pht('Name'))
->setName('name') ->setName('name')
@ -468,12 +467,14 @@ final class PhabricatorCalendarEventEditController
$view_policies = id(new AphrontFormPolicyControl()) $view_policies = id(new AphrontFormPolicyControl())
->setUser($viewer) ->setUser($viewer)
->setValue($view_policy)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
->setPolicyObject($event) ->setPolicyObject($event)
->setPolicies($current_policies) ->setPolicies($current_policies)
->setName('viewPolicy'); ->setName('viewPolicy');
$edit_policies = id(new AphrontFormPolicyControl()) $edit_policies = id(new AphrontFormPolicyControl())
->setUser($viewer) ->setUser($viewer)
->setValue($edit_policy)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setPolicyObject($event) ->setPolicyObject($event)
->setPolicies($current_policies) ->setPolicies($current_policies)