From 51facbabba91dd3f22f78ad67aec812a9a1b8372 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sun, 10 May 2015 11:14:24 -0700 Subject: [PATCH] Deprecating BrowseController and getting rid of unneeded calls to `getTerseSummary()` and `getHumanStatus()` Summary: Ref T8050, Deprecating BrowseController and getting rid of unneeded calls to `getTerseSummary()` and `getHumanStatus()` Test Plan: Use calendar, make sure nothing explodes Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T8050 Differential Revision: https://secure.phabricator.com/D12791 --- .../PhabricatorCalendarBrowseController.php | 97 ------------------- .../PhabricatorCalendarEventSearchEngine.php | 5 +- .../storage/PhabricatorCalendarEvent.php | 5 - 3 files changed, 1 insertion(+), 106 deletions(-) delete mode 100644 src/applications/calendar/controller/PhabricatorCalendarBrowseController.php diff --git a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php deleted file mode 100644 index ba2017cba9..0000000000 --- a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php +++ /dev/null @@ -1,97 +0,0 @@ -getViewer(); - - $now = time(); - $year_d = phabricator_format_local_time($now, $viewer, 'Y'); - $year = $request->getInt('year', $year_d); - $month_d = phabricator_format_local_time($now, $viewer, 'm'); - $month = $request->getInt('month', $month_d); - $day = phabricator_format_local_time($now, $viewer, 'j'); - - $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere( - 'day BETWEEN %s AND %s', - "{$year}-{$month}-01", - "{$year}-{$month}-31"); - - $statuses = id(new PhabricatorCalendarEventQuery()) - ->setViewer($viewer) - ->withDateRange( - strtotime("{$year}-{$month}-01"), - strtotime("{$year}-{$month}-01 next month")) - ->execute(); - - if ($month == $month_d && $year == $year_d) { - $month_view = new PHUICalendarMonthView($month, $year, $day); - } else { - $month_view = new PHUICalendarMonthView($month, $year); - } - - $month_view->setBrowseURI($request->getRequestURI()); - $month_view->setUser($viewer); - $month_view->setHolidays($holidays); - - $phids = mpull($statuses, 'getUserPHID'); - $handles = $viewer->loadHandles($phids); - - /* Assign Colors */ - $unique = array_unique($phids); - $allblue = false; - $calcolors = CalendarColors::getColors(); - if (count($unique) > count($calcolors)) { - $allblue = true; - } - $i = 0; - $eventcolor = array(); - foreach ($unique as $phid) { - if ($allblue) { - $eventcolor[$phid] = CalendarColors::COLOR_SKY; - } else { - $eventcolor[$phid] = $calcolors[$i]; - } - $i++; - } - - foreach ($statuses as $status) { - $event = new AphrontCalendarEventView(); - $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); - - $name_text = $handles[$status->getUserPHID()]->getName(); - $status_text = $status->getHumanStatus(); - $event->setUserPHID($status->getUserPHID()); - $event->setDescription(pht('%s (%s)', $name_text, $status_text)); - $event->setName($status_text); - $event->setEventID($status->getID()); - $event->setColor($eventcolor[$status->getUserPHID()]); - $month_view->addEvent($event); - } - - $date = new DateTime("{$year}-{$month}-01"); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb(pht('All Events')); - $crumbs->addTextCrumb($date->format('F Y')); - - $nav = $this->buildSideNavView(); - $nav->selectFilter('all/'); - $nav->appendChild( - array( - $crumbs, - $month_view, - )); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => pht('Calendar'), - )); - } - -} diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 46f6419ba4..e3aecc89ba 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -284,15 +284,12 @@ final class PhabricatorCalendarEventSearchEngine $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($name) + ->setHeader($event->getName()) ->setHref($href) ->setBarColor($color) ->addByline(pht('Creator: %s', $creator_handle->renderLink())) diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 133b130614..af756b5273 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -168,11 +168,6 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO ); } - public function getHumanStatus() { - $options = $this->getStatusOptions(); - return $options[$this->status]; - } - protected function getConfiguration() { return array( self::CONFIG_AUX_PHID => true,