From 604b780953497567d6349ba0ba377670606ebe61 Mon Sep 17 00:00:00 2001 From: Jeremy Cowgar Date: Sun, 7 Feb 2016 10:00:14 -0800 Subject: [PATCH] Fix an issue where 'Attending' would appear on calendar view unnecessarily Summary: Ref T10295 * Viewing Upcoming Events in the calendar would display 'Attending: ' even if there were not attendees. This caused confusion, such as 'Is it telling me I am "Attending?"' * When a calendar event has no attendees, simply do not display the 'Attending: ' label Test Plan: * Add a new event with no one attending. * Add a new event with one or more attendees. * View the Upcoming Events query of the Calendar app. * Notice how the one with no attendees does not show 'Attending: ' while the other with attendees will show the already existing 'Attending: jdoe, ssmith' label. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T10295 Differential Revision: https://secure.phabricator.com/D15207 --- .../PhabricatorCalendarEventSearchEngine.php | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 8614e68f56..c23996470d 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -266,7 +266,6 @@ final class PhabricatorCalendarEventSearchEngine $list = new PHUIObjectItemListView(); foreach ($events as $event) { - $duration = ''; $event_date_info = $this->getEventDateLabel($event); $creator_handle = $handles[$event->getUserPHID()]; $attendees = array(); @@ -275,18 +274,6 @@ final class PhabricatorCalendarEventSearchEngine $attendees[] = $invitee->getInviteePHID(); } - $attendees = pht( - 'Attending: %s', - $viewer->renderHandleList($attendees) - ->setAsInline(1) - ->render()); - - if (strlen($event->getDuration()) > 0) { - $duration = pht( - 'Duration: %s', - $event->getDuration()); - } - if ($event->getIsGhostEvent()) { $title_text = $event->getMonogram() .' (' @@ -302,9 +289,25 @@ final class PhabricatorCalendarEventSearchEngine ->setObject($event) ->setHeader($title_text) ->setHref($event->getURI()) - ->addAttribute($event_date_info) - ->addAttribute($attendees) - ->addIcon('none', $duration); + ->addAttribute($event_date_info); + + if ($attendees) { + $attending = pht( + 'Attending: %s', + $viewer->renderHandleList($attendees) + ->setAsInline(1) + ->render()); + + $item->addAttribute($attending); + } + + if (strlen($event->getDuration()) > 0) { + $duration = pht( + 'Duration: %s', + $event->getDuration()); + + $item->addIcon('none', $duration); + } $list->addItem($item); }