Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18894848
D13033.id31425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13033.id31425.diff
View Options
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('Create Private Event')
+ ->setHref('/calendar/event/create/?public=true'))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName('Create Public Event')
+ ->setHref('/calendar/event/create/?public=false'));
$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);
+ $is_public = $request->getStr('public');
+ $event = PhabricatorCalendarEvent::initializeNewCalendarEvent(
+ $viewer,
+ $is_public);
$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,
+ $is_public) {
$app = id(new PhabricatorApplicationQuery())
->setViewer($actor)
->withClasses(array('PhabricatorCalendarApplication'))
->executeOne();
+ if ($is_public == 'true') {
+ $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
Details
Attached
Mime Type
text/plain
Expires
Nov 8 2025, 2:15 PM (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
10101256
Default Alt Text
D13033.id31425.diff (2 KB)
Attached To
Mode
D13033: Create button should be a dropdown with public and private options
Attached
Detach File
Event Timeline
Log In to Comment