@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.

Calendar events should be green if viewer is invited, and grey if not.

Summary: Closes T8189, Calendar events should be green if viewer is invited, and grey if not.

Test Plan: Check that month and day views display events that viewer is invited to as green and grey otherwise, including month day badges on mobile monthly view.

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8189

Differential Revision: https://secure.phabricator.com/D12850

+142 -54
+6 -6
resources/celerity/map.php
··· 120 120 'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9', 121 121 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 122 122 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 123 - 'rsrc/css/phui/calendar/phui-calendar-day.css' => '38891735', 123 + 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 124 124 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', 125 - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3150cfbf', 126 - 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', 125 + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '3e42c803', 126 + 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 127 127 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 128 128 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', 129 129 'rsrc/css/phui/phui-action-panel.css' => '3ee9afd5', ··· 760 760 'phui-action-panel-css' => '3ee9afd5', 761 761 'phui-box-css' => '7b3a2eed', 762 762 'phui-button-css' => 'de610129', 763 - 'phui-calendar-css' => '8675968e', 764 - 'phui-calendar-day-css' => '38891735', 763 + 'phui-calendar-css' => '8345be98', 764 + 'phui-calendar-day-css' => '3b4a65d8', 765 765 'phui-calendar-list-css' => 'c1d0ca59', 766 - 'phui-calendar-month-css' => '3150cfbf', 766 + 'phui-calendar-month-css' => '3e42c803', 767 767 'phui-crumbs-view-css' => '594d719e', 768 768 'phui-document-view-css' => '94d5dcd8', 769 769 'phui-feed-story-css' => 'c9f3a0b5',
+2
src/applications/calendar/constants/CalendarColors.php
··· 10 10 const COLOR_SKY = 'sky'; 11 11 const COLOR_INDIGO = 'indigo'; 12 12 const COLOR_VIOLET = 'violet'; 13 + const COLOR_GREY = 'grey'; 13 14 14 15 public static function getColors() { 15 16 return array( ··· 21 22 self::COLOR_INDIGO, 22 23 self::COLOR_RED, 23 24 self::COLOR_YELLOW, 25 + self::COLOR_GREY, 24 26 ); 25 27 } 26 28
+6 -19
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 359 359 360 360 $phids = mpull($statuses, 'getUserPHID'); 361 361 362 - /* Assign Colors */ 363 - $unique = array_unique($phids); 364 - $allblue = false; 365 - $calcolors = CalendarColors::getColors(); 366 - if (count($unique) > count($calcolors)) { 367 - $allblue = true; 368 - } 369 - $i = 0; 370 - $eventcolor = array(); 371 - foreach ($unique as $phid) { 372 - if ($allblue) { 373 - $eventcolor[$phid] = CalendarColors::COLOR_SKY; 374 - } else { 375 - $eventcolor[$phid] = $calcolors[$i]; 376 - } 377 - $i++; 378 - } 362 + foreach ($statuses as $status) { 363 + $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); 379 364 380 - foreach ($statuses as $status) { 381 365 $event = new AphrontCalendarEventView(); 382 366 $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); 383 367 $event->setIsAllDay($status->getIsAllDay()); ··· 388 372 $event->setDescription(pht('%s (%s)', $name_text, $status_text)); 389 373 $event->setName($status_text); 390 374 $event->setEventID($status->getID()); 391 - $event->setColor($eventcolor[$status->getUserPHID()]); 375 + $event->setViewerIsInvited($viewer_is_invited); 392 376 $month_view->addEvent($event); 393 377 } 394 378 ··· 422 406 continue; 423 407 } 424 408 409 + $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID()); 410 + 425 411 $event = new AphrontCalendarEventView(); 426 412 $event->setEventID($status->getID()); 427 413 $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); 428 414 $event->setIsAllDay($status->getIsAllDay()); 415 + $event->setViewerIsInvited($viewer_is_invited); 429 416 430 417 $event->setName($status->getName()); 431 418 $event->setURI('/'.$status->getMonogram());
+10
src/applications/calendar/storage/PhabricatorCalendarEvent.php
··· 215 215 return $is_attending; 216 216 } 217 217 218 + public function getIsUserInvited($phid) { 219 + $uninvited_status = PhabricatorCalendarEventInvitee::STATUS_UNINVITED; 220 + $declined_status = PhabricatorCalendarEventInvitee::STATUS_DECLINED; 221 + $status = $this->getUserInviteStatus($phid); 222 + if ($status == $uninvited_status || $status == $declined_status) { 223 + return false; 224 + } 225 + return true; 226 + } 227 + 218 228 /* -( Markup Interface )--------------------------------------------------- */ 219 229 220 230
+9 -13
src/applications/calendar/view/AphrontCalendarEventView.php
··· 8 8 private $epochEnd; 9 9 private $description; 10 10 private $eventID; 11 - private $color; 11 + private $viewerIsInvited; 12 12 private $uri; 13 13 private $isAllDay; 14 14 ··· 27 27 } 28 28 public function getEventID() { 29 29 return $this->eventID; 30 + } 31 + 32 + public function setViewerIsInvited($viewer_is_invited) { 33 + $this->viewerIsInvited = $viewer_is_invited; 34 + return $this; 35 + } 36 + public function getViewerIsInvited() { 37 + return $this->viewerIsInvited; 30 38 } 31 39 32 40 public function setUserPHID($user_phid) { ··· 68 76 69 77 public function getDescription() { 70 78 return $this->description; 71 - } 72 - 73 - public function setColor($color) { 74 - $this->color = $color; 75 - return $this; 76 - } 77 - public function getColor() { 78 - if ($this->color) { 79 - return $this->color; 80 - } else { 81 - return CalendarColors::COLOR_SKY; 82 - } 83 79 } 84 80 85 81 public function setIsAllDay($is_all_day) {
+13 -2
src/view/phui/calendar/PHUICalendarDayView.php
··· 391 391 } 392 392 393 393 private function drawAllDayEvent(AphrontCalendarEventView $event) { 394 + $class = 'day-view-all-day'; 395 + if ($event->getViewerIsInvited()) { 396 + $class = $class.' viewer-invited-day-event'; 397 + } 398 + 394 399 $name = phutil_tag( 395 400 'a', 396 401 array( 397 - 'class' => 'day-view-all-day', 402 + 'class' => $class, 398 403 'href' => $event->getURI(), 399 404 ), 400 405 $event->getName()); ··· 425 430 $width, 426 431 $top, 427 432 $height) { 433 + 434 + $class = 'phui-calendar-day-event-link'; 435 + if ($event->getViewerIsInvited()) { 436 + $class = $class.' viewer-invited-day-event'; 437 + } 438 + 428 439 $name = phutil_tag( 429 440 'a', 430 441 array( 431 - 'class' => 'phui-calendar-day-event-link', 442 + 'class' => $class, 432 443 'href' => $event->getURI(), 433 444 ), 434 445 $event->getName());
+14 -3
src/view/phui/calendar/PHUICalendarListView.php
··· 33 33 $singletons = array(); 34 34 $allday = false; 35 35 foreach ($this->events as $event) { 36 - $color = $event->getColor(); 37 36 $start_epoch = $event->getEpochStart(); 38 37 39 38 if ($event->getIsAllDay()) { ··· 65 64 ), 66 65 $timelabel); 67 66 68 - $class = 'phui-calendar-list-item phui-calendar-'.$color; 67 + $class = 'phui-calendar-list-item'; 68 + if ($event->getViewerIsInvited()) { 69 + $class = $class.' phui-calendar-viewer-invited'; 70 + } 69 71 if ($event->getIsAllDay()) { 70 72 $class = $class.' all-day'; 71 73 } ··· 142 144 $description = pht('(%s)', $event->getName()); 143 145 } 144 146 145 - $class = 'phui-calendar-item-link'; 147 + $class = 'phui-calendar-item'; 146 148 147 149 $anchor = javelin_tag( 148 150 'a', ··· 158 160 $event->getName()); 159 161 160 162 return $anchor; 163 + } 164 + 165 + public function getIsViewerInvitedOnList() { 166 + foreach ($this->events as $event) { 167 + if ($event->getViewerIsInvited()) { 168 + return true; 169 + } 170 + } 171 + return false; 161 172 } 162 173 }
+11 -3
src/view/phui/calendar/PHUICalendarMonthView.php
··· 178 178 $uri = $event_list['uri']; 179 179 $count = $event_list['count']; 180 180 181 - $event_count_badge = $this->getEventCountBadge($count); 181 + $viewer_is_invited = $list->getIsViewerInvitedOnList(); 182 + 183 + $event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited); 182 184 $cell_day_secret_link = $this->getHiddenDayLink($uri); 183 185 184 186 $cell_data_div = phutil_tag( ··· 252 254 $cell_div); 253 255 } 254 256 255 - private function getEventCountBadge($count) { 257 + private function getEventCountBadge($count, $viewer_is_invited) { 258 + $class = 'phui-calendar-month-count-badge'; 259 + 260 + if ($viewer_is_invited) { 261 + $class = $class.' viewer-invited-day-badge'; 262 + } 263 + 256 264 $event_count = null; 257 265 if ($count > 0) { 258 266 $event_count = phutil_tag( 259 267 'div', 260 268 array( 261 - 'class' => 'phui-calendar-month-count-badge', 269 + 'class' => $class, 262 270 ), 263 271 $count); 264 272 }
+16 -4
webroot/rsrc/css/phui/calendar/phui-calendar-day.css
··· 37 37 38 38 .phui-calendar-day-event-link { 39 39 padding: 8px; 40 - border: 1px solid {$blueborder}; 41 - background-color: {$bluebackground}; 40 + border: 1px solid {$greyborder}; 41 + background-color: {$darkgreybackground}; 42 42 margin: 0 4px; 43 43 position: absolute; 44 44 left: 0; ··· 47 47 bottom: 0; 48 48 text-decoration: none; 49 49 color: {$greytext}; 50 + } 51 + 52 + .phui-calendar-day-event-link.viewer-invited-day-event { 53 + border-color: {$green}; 54 + background-color: {$lightgreen}; 55 + color: {$green}; 50 56 } 51 57 52 58 .day-view-all-day { 53 - border: 1px solid {$blueborder}; 59 + border: 1px solid {$greyborder}; 54 60 height: 12px; 55 61 margin: 0; 56 62 display: block; 57 63 padding: 8px; 58 - background-color: {$bluebackground}; 64 + background-color: {$darkgreybackground}; 59 65 text-decoration: none; 60 66 color: {$greytext}; 67 + } 68 + 69 + .day-view-all-day.viewer-invited-day-event { 70 + border-color: {$green}; 71 + background-color: {$lightgreen}; 72 + color: {$green}; 61 73 } 62 74 63 75 .phui-calendar-day-event + .phui-calendar-day-event .day-view-all-day {
+18 -3
webroot/rsrc/css/phui/calendar/phui-calendar-month.css
··· 73 73 margin: 0 auto; 74 74 } 75 75 76 + .phui-calendar-month-count-badge.viewer-invited-day-badge { 77 + border-color: {$green}; 78 + color: {$green}; 79 + } 80 + 76 81 table.phui-calendar-view a.phui-calendar-date-number { 77 82 color: {$lightgreytext}; 78 83 padding: 0 4px; ··· 116 121 117 122 .phui-calendar-view .phui-calendar-list li.phui-calendar-list-item.all-day { 118 123 margin: 0; 119 - padding: 4px 8px; 120 - background-color: {$lightpink}; 124 + padding: 4px 4px 0px 4px; 125 + background-color: {$darkgreybackground}; 121 126 display: block; 122 127 float: none; 123 128 } 124 129 130 + .phui-calendar-view 131 + .phui-calendar-list 132 + li.phui-calendar-viewer-invited.all-day { 133 + background-color: {$lightgreen}; 134 + } 135 + 125 136 li.phui-calendar-list-item.all-day:first-child { 126 137 margin-top: 0; 127 138 } ··· 155 166 } 156 167 157 168 li.phui-calendar-list-item.all-day .phui-calendar-list-title a{ 158 - color: {$pink}; 169 + color: {$greytext}; 170 + } 171 + 172 + li.phui-calendar-viewer-invited.all-day .phui-calendar-list-title a{ 173 + color: {$green}; 159 174 } 160 175 161 176 .phui-calendar-view .phui-calendar-list-time {
+37 -1
webroot/rsrc/css/phui/calendar/phui-calendar.css
··· 2 2 * @provides phui-calendar-css 3 3 */ 4 4 5 + .phui-calendar-list a { 6 + color: {$lightgreytext}; 7 + } 8 + 9 + .phui-calendar-viewer-invited a { 10 + color: {$green}; 11 + font-weight: bold; 12 + } 13 + 5 14 .phui-calendar-red a { 6 15 color: {$red}; 7 16 } ··· 34 43 color: {$violet}; 35 44 } 36 45 46 + .phui-calendar-grey a { 47 + color: {$lightgreytext}; 48 + } 49 + 50 + .phui-calendar-bg-viewer-invited { 51 + background-color: {$lightgreen}; 52 + } 53 + 37 54 .phui-calendar-bg-red { 38 55 background-color: {$lightred}; 39 56 } ··· 47 64 } 48 65 49 66 .phui-calendar-bg-green { 50 - background-color: {$lightgreen} 67 + background-color: {$lightgreen}; 51 68 } 52 69 53 70 .phui-calendar-bg-blue { ··· 66 83 background-color: {$lightviolet}; 67 84 } 68 85 86 + .phui-calendar-bg-grey { 87 + background-color: {$darkgreybackground}; 88 + } 89 + 90 + .phui-calendar-list-dot { 91 + background-color: {$lightgreytext}; 92 + border-color: {$lightgreytext}; 93 + } 94 + 95 + .phui-calendar-viewer-invited .phui-calendar-list-dot { 96 + background-color: {$green}; 97 + border-color: {$green}; 98 + } 99 + 69 100 .phui-calendar-red .phui-calendar-list-dot { 70 101 background-color: {$red}; 71 102 border-color: {$red}; ··· 105 136 background-color: {$violet}; 106 137 border-color: {$violet}; 107 138 } 139 + 140 + .phui-calendar-grey .phui-calendar-list-dot { 141 + background-color: {$lightgreytext}; 142 + border-color: {$lightgreytext}; 143 + }