@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+1 -106
-97
src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
··· 1 - <?php 2 - 3 - final class PhabricatorCalendarBrowseController 4 - extends PhabricatorCalendarController { 5 - 6 - public function shouldAllowPublic() { 7 - return true; 8 - } 9 - 10 - public function handleRequest(AphrontRequest $request) { 11 - $viewer = $this->getViewer(); 12 - 13 - $now = time(); 14 - $year_d = phabricator_format_local_time($now, $viewer, 'Y'); 15 - $year = $request->getInt('year', $year_d); 16 - $month_d = phabricator_format_local_time($now, $viewer, 'm'); 17 - $month = $request->getInt('month', $month_d); 18 - $day = phabricator_format_local_time($now, $viewer, 'j'); 19 - 20 - $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere( 21 - 'day BETWEEN %s AND %s', 22 - "{$year}-{$month}-01", 23 - "{$year}-{$month}-31"); 24 - 25 - $statuses = id(new PhabricatorCalendarEventQuery()) 26 - ->setViewer($viewer) 27 - ->withDateRange( 28 - strtotime("{$year}-{$month}-01"), 29 - strtotime("{$year}-{$month}-01 next month")) 30 - ->execute(); 31 - 32 - if ($month == $month_d && $year == $year_d) { 33 - $month_view = new PHUICalendarMonthView($month, $year, $day); 34 - } else { 35 - $month_view = new PHUICalendarMonthView($month, $year); 36 - } 37 - 38 - $month_view->setBrowseURI($request->getRequestURI()); 39 - $month_view->setUser($viewer); 40 - $month_view->setHolidays($holidays); 41 - 42 - $phids = mpull($statuses, 'getUserPHID'); 43 - $handles = $viewer->loadHandles($phids); 44 - 45 - /* Assign Colors */ 46 - $unique = array_unique($phids); 47 - $allblue = false; 48 - $calcolors = CalendarColors::getColors(); 49 - if (count($unique) > count($calcolors)) { 50 - $allblue = true; 51 - } 52 - $i = 0; 53 - $eventcolor = array(); 54 - foreach ($unique as $phid) { 55 - if ($allblue) { 56 - $eventcolor[$phid] = CalendarColors::COLOR_SKY; 57 - } else { 58 - $eventcolor[$phid] = $calcolors[$i]; 59 - } 60 - $i++; 61 - } 62 - 63 - foreach ($statuses as $status) { 64 - $event = new AphrontCalendarEventView(); 65 - $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); 66 - 67 - $name_text = $handles[$status->getUserPHID()]->getName(); 68 - $status_text = $status->getHumanStatus(); 69 - $event->setUserPHID($status->getUserPHID()); 70 - $event->setDescription(pht('%s (%s)', $name_text, $status_text)); 71 - $event->setName($status_text); 72 - $event->setEventID($status->getID()); 73 - $event->setColor($eventcolor[$status->getUserPHID()]); 74 - $month_view->addEvent($event); 75 - } 76 - 77 - $date = new DateTime("{$year}-{$month}-01"); 78 - $crumbs = $this->buildApplicationCrumbs(); 79 - $crumbs->addTextCrumb(pht('All Events')); 80 - $crumbs->addTextCrumb($date->format('F Y')); 81 - 82 - $nav = $this->buildSideNavView(); 83 - $nav->selectFilter('all/'); 84 - $nav->appendChild( 85 - array( 86 - $crumbs, 87 - $month_view, 88 - )); 89 - 90 - return $this->buildApplicationPage( 91 - $nav, 92 - array( 93 - 'title' => pht('Calendar'), 94 - )); 95 - } 96 - 97 - }
+1 -4
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 284 284 $to = phabricator_datetime($event->getDateTo(), $viewer); 285 285 $creator_handle = $handles[$event->getUserPHID()]; 286 286 287 - $name = (strlen($event->getName())) ? 288 - $event->getName() : $event->getTerseSummary($viewer); 289 - 290 287 $color = ($event->getStatus() == PhabricatorCalendarEvent::STATUS_AWAY) 291 288 ? 'red' 292 289 : 'yellow'; 293 290 294 291 $item = id(new PHUIObjectItemView()) 295 - ->setHeader($name) 292 + ->setHeader($event->getName()) 296 293 ->setHref($href) 297 294 ->setBarColor($color) 298 295 ->addByline(pht('Creator: %s', $creator_handle->renderLink()))
-5
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 168 168 ); 169 169 } 170 170 171 - public function getHumanStatus() { 172 - $options = $this->getStatusOptions(); 173 - return $options[$this->status]; 174 - } 175 - 176 171 protected function getConfiguration() { 177 172 return array( 178 173 self::CONFIG_AUX_PHID => true,