Page MenuHomePhabricator

D13033.id31449.diff
No OneTemporary

D13033.id31449.diff

diff --git a/src/applications/calendar/controller/PhabricatorCalendarController.php b/src/applications/calendar/controller/PhabricatorCalendarController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarController.php
@@ -9,9 +9,12 @@
->setUser($this->getViewer())
->addAction(
id(new PhabricatorActionView())
- ->setName('asdf')
- ->setHref('#')
- ->setIcon('fa-pencil'));
+ ->setName(pht('Create Private Event'))
+ ->setHref('/calendar/event/create/?mode=private'))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Create Public Event'))
+ ->setHref('/calendar/event/create/?mode=public'));
$crumbs->addAction(
id(new PHUIListItemView())
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
@@ -29,7 +29,10 @@
$uri_query = $request->getStr('query');
if ($this->isCreate()) {
- $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($viewer);
+ $mode = $request->getStr('mode');
+ $event = PhabricatorCalendarEvent::initializeNewCalendarEvent(
+ $viewer,
+ $mode);
$create_start_year = $request->getInt('year');
$create_start_month = $request->getInt('month');
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
@@ -28,18 +28,26 @@
private $invitees = self::ATTACHABLE;
private $appliedViewer;
- public static function initializeNewCalendarEvent(PhabricatorUser $actor) {
+ public static function initializeNewCalendarEvent(
+ PhabricatorUser $actor,
+ $mode) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
->withClasses(array('PhabricatorCalendarApplication'))
->executeOne();
+ if ($mode == 'public') {
+ $view_policy = PhabricatorPolicies::getMostOpenPolicy();
+ } else {
+ $view_policy = $actor->getPHID();
+ }
+
return id(new PhabricatorCalendarEvent())
->setUserPHID($actor->getPHID())
->setIsCancelled(0)
->setIsAllDay(0)
->setIcon(self::DEFAULT_ICON)
- ->setViewPolicy($actor->getPHID())
+ ->setViewPolicy($view_policy)
->setEditPolicy($actor->getPHID())
->attachInvitees(array())
->applyViewerTimezone($actor);

File Metadata

Mime Type
text/plain
Expires
Sep 26 2025, 6:24 AM (6 w, 47 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
10104462
Default Alt Text
D13033.id31449.diff (2 KB)

Event Timeline