From f14e0bf2efb28feddad6575050854cfa5fec7d2c Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 30 Apr 2015 13:22:13 -0700 Subject: [PATCH] Calendar items in Upcoming Events query should link to events, not calendar Summary: Closes T7933, Calendar items in Upcoming Events query should link to events, not calendar. Test Plan: Open Upcoming Events query, click on an event, event detail view should open. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7933 Differential Revision: https://secure.phabricator.com/D12631 --- .../PhabricatorCalendarEventSearchEngine.php | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index c7409f3a04..271550e446 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -191,35 +191,23 @@ final class PhabricatorCalendarEventSearchEngine PhabricatorSavedQuery $query, array $handles) { assert_instances_of($events, 'PhabricatorCalendarEvent'); - $viewer = $this->requireViewer(); - $list = new PHUIObjectItemListView(); foreach ($events as $event) { - if ($event->getUserPHID() == $viewer->getPHID()) { - $href = '/E'.$event->getID(); - } else { - $from = $event->getDateFrom(); - $month = phabricator_format_local_time($from, $viewer, 'm'); - $year = phabricator_format_local_time($from, $viewer, 'Y'); - $uri = new PhutilURI($this->getApplicationURI()); - $uri->setQueryParams( - array( - 'month' => $month, - 'year' => $year, - )); - $href = (string) $uri; - } + $href = '/E'.$event->getID(); $from = phabricator_datetime($event->getDateFrom(), $viewer); $to = phabricator_datetime($event->getDateTo(), $viewer); $creator_handle = $handles[$event->getUserPHID()]; + $name = (strlen($event->getName())) ? + $event->getName() : $event->getTerseSummary($viewer); + $color = ($event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY) ? 'red' : 'yellow'; $item = id(new PHUIObjectItemView()) - ->setHeader($event->getTerseSummary($viewer)) + ->setHeader($name) ->setHref($href) ->setBarColor($color) ->addByline(pht('Creator: %s', $creator_handle->renderLink()))