1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

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
This commit is contained in:
lkassianik 2015-04-30 13:22:13 -07:00
parent 47f91c322d
commit f14e0bf2ef

View file

@ -191,35 +191,23 @@ final class PhabricatorCalendarEventSearchEngine
PhabricatorSavedQuery $query, PhabricatorSavedQuery $query,
array $handles) { array $handles) {
assert_instances_of($events, 'PhabricatorCalendarEvent'); assert_instances_of($events, 'PhabricatorCalendarEvent');
$viewer = $this->requireViewer(); $viewer = $this->requireViewer();
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
foreach ($events as $event) { foreach ($events as $event) {
if ($event->getUserPHID() == $viewer->getPHID()) {
$href = '/E'.$event->getID(); $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;
}
$from = phabricator_datetime($event->getDateFrom(), $viewer); $from = phabricator_datetime($event->getDateFrom(), $viewer);
$to = phabricator_datetime($event->getDateTo(), $viewer); $to = phabricator_datetime($event->getDateTo(), $viewer);
$creator_handle = $handles[$event->getUserPHID()]; $creator_handle = $handles[$event->getUserPHID()];
$name = (strlen($event->getName())) ?
$event->getName() : $event->getTerseSummary($viewer);
$color = ($event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY) $color = ($event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY)
? 'red' ? 'red'
: 'yellow'; : 'yellow';
$item = id(new PHUIObjectItemView()) $item = id(new PHUIObjectItemView())
->setHeader($event->getTerseSummary($viewer)) ->setHeader($name)
->setHref($href) ->setHref($href)
->setBarColor($color) ->setBarColor($color)
->addByline(pht('Creator: %s', $creator_handle->renderLink())) ->addByline(pht('Creator: %s', $creator_handle->renderLink()))