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 @@ -35,12 +35,24 @@ if ($request->isFormPost()) { $new_status = null; - if ($is_attending) { - $new_status = array($viewer->getPHID() => $declined_status); - } else { - $new_status = array($viewer->getPHID() => $attending_status); + switch ($action) { + case self::ACTION_ACCEPT: + $new_status = $attending_status; + break; + case self::ACTION_JOIN: + if ($is_attending) { + $new_status = $declined_status; + } else { + $new_status = $attending_status; + } + break; + case self::ACTION_DECLINE: + $new_status = $declined_status; + break; } + $new_status = array($viewer->getPHID() => $new_status); + $xaction = id(new PhabricatorCalendarEventTransaction()) ->setTransactionType( PhabricatorCalendarEventTransaction::TYPE_INVITE) 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 @@ -200,11 +200,36 @@ if ($invitees) { $invitee_list = new PHUIStatusListView(); + + $icon_invited = PHUIStatusItemView::ICON_OPEN; + $icon_attending = PHUIStatusItemView::ICON_ACCEPT; + $icon_declined = PHUIStatusItemView::ICON_REJECT; + + $status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED; + $status_attending = PhabricatorCalendarEventInvitee::STATUS_ATTENDING; + $status_declined = PhabricatorCalendarEventInvitee::STATUS_DECLINED; + + $icon_map = array( + $status_invited => $icon_invited, + $status_attending => $icon_attending, + $status_declined => $icon_declined, + ); + + $icon_color_map = array( + $status_invited => null, + $status_attending => 'green', + $status_declined => 'red', + ); + foreach ($invitees as $invitee) { $item = new PHUIStatusItemView(); $invitee_phid = $invitee->getInviteePHID(); + $status = $invitee->getStatus(); $target = $viewer->renderHandle($invitee_phid); - $item->setNote($invitee->getStatus()) + $icon = $icon_map[$status]; + $icon_color = $icon_color_map[$status]; + + $item->setIcon($icon, $icon_color) ->setTarget($target); $invitee_list->addItem($item); }