Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13975376
D12619.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12619.diff
View Options
diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php
--- a/src/applications/calendar/application/PhabricatorCalendarApplication.php
+++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php
@@ -53,7 +53,7 @@
=> 'PhabricatorCalendarEventEditController',
'cancel/(?P<id>[1-9]\d*)/'
=> 'PhabricatorCalendarEventCancelController',
- 'join/(?P<id>[1-9]\d*)/'
+ '(?P<action>join|decline|accept)/(?P<id>[1-9]\d*)/'
=> 'PhabricatorCalendarEventJoinController',
),
),
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
@@ -65,6 +65,7 @@
$subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$event->getPHID());
+
$invitees = array();
foreach ($event->getInvitees() as $invitee) {
if ($invitee->isUninvited()) {
@@ -84,12 +85,12 @@
$end_value = $end_time->readValueFromRequest($request);
$description = $request->getStr('description');
$subscribers = $request->getArr('subscribers');
+
$invitees = $request->getArr('invitees');
$new_invitees = $this->getNewInviteeList($invitees, $event);
-
+ $status_attending = PhabricatorCalendarEventInvitee::STATUS_ATTENDING;
if ($this->isCreate()) {
$status = idx($new_invitees, $user->getPHID());
- $status_attending = PhabricatorCalendarEventInvitee::STATUS_ATTENDING;
if ($status) {
$new_invitees[$user->getPHID()] = $status_attending;
}
@@ -256,12 +257,9 @@
$new = array();
foreach ($phids as $phid) {
- $old_invitee = idx($invitees, $phid);
- if ($old_invitee) {
- $old_status = $old_invitee->getStatus();
- if ($old_status != $uninvited_status) {
- continue;
- }
+ $old_status = $event->getUserInviteStatus($phid);
+ if ($old_status != $uninvited_status) {
+ continue;
}
$new[$phid] = $invited_status;
}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventJoinController.php b/src/applications/calendar/controller/PhabricatorCalendarEventJoinController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventJoinController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventJoinController.php
@@ -5,8 +5,14 @@
private $id;
+ const ACTION_ACCEPT = 'accept';
+ const ACTION_DECLINE = 'decline';
+ const ACTION_JOIN = 'join';
+
public function handleRequest(AphrontRequest $request) {
$this->id = $request->getURIData('id');
+ $action = $request->getURIData('action');
+
$request = $this->getRequest();
$viewer = $request->getViewer();
$declined_status = PhabricatorCalendarEventInvitee::STATUS_DECLINED;
@@ -54,7 +60,8 @@
}
}
- if (!$is_attending) {
+ if (($action == self::ACTION_JOIN && !$is_attending)
+ || $action == self::ACTION_ACCEPT) {
$title = pht('Join Event');
$paragraph = pht('Would you like to join this event?');
$submit = pht('Join');
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php
@@ -56,16 +56,44 @@
private function buildHeaderView(PhabricatorCalendarEvent $event) {
$viewer = $this->getRequest()->getUser();
+ $id = $event->getID();
+
$is_cancelled = $event->getIsCancelled();
$icon = $is_cancelled ? ('fa-times') : ('fa-calendar');
$color = $is_cancelled ? ('grey') : ('green');
$status = $is_cancelled ? ('Cancelled') : ('Active');
- return id(new PHUIHeaderView())
+ $invite_status = $event->getUserInviteStatus($viewer->getPHID());
+ $status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED;
+ $is_invite_pending = ($invite_status == $status_invited);
+
+ $header = id(new PHUIHeaderView())
->setUser($viewer)
->setHeader($event->getName())
->setStatus($icon, $color, $status)
->setPolicyObject($event);
+
+ if ($is_invite_pending) {
+ $decline_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon(id(new PHUIIconView())
+ ->setIconFont('fa-times grey'))
+ ->setHref($this->getApplicationURI("/event/decline/{$id}/"))
+ ->setWorkflow(true)
+ ->setText(pht('Decline'));
+
+ $accept_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon(id(new PHUIIconView())
+ ->setIconFont('fa-check green'))
+ ->setHref($this->getApplicationURI("/event/accept/{$id}/"))
+ ->setWorkflow(true)
+ ->setText(pht('Accept'));
+
+ $header->addActionLink($decline_button)
+ ->addActionLink($accept_button);
+ }
+ return $header;
}
private function buildActionView(PhabricatorCalendarEvent $event) {
@@ -153,8 +181,8 @@
$item = new PHUIStatusItemView();
$invitee_phid = $invitee->getInviteePHID();
$target = $viewer->renderHandle($invitee_phid);
- $item->setNote($invitee->getStatus());
- $item->setTarget($target);
+ $item->setNote($invitee->getStatus())
+ ->setTarget($target);
$invitee_list->addItem($item);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 19, 9:52 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710941
Default Alt Text
D12619.diff (5 KB)
Attached To
Mode
D12619: Ability to RSVP to event
Attached
Detach File
Event Timeline
Log In to Comment