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

Separate handle "status" and "availability"

Summary:
Ref T7707. Handles currently have a "status" field and a "disabled" field.

The "status" field has these possible values: "open", "closed", "1", "2". durp durp durp

Instead, do:

- status = <open, closed>
- availability = <full, partial, none, disabled>

I think these make more sense? And are a bit more general? And use the same kind of constants for all values!

Test Plan: Looked at all affected handles in all states (probably).

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7707

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

+76 -75
+3 -3
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => '7ac320f1', 10 + 'core.pkg.css' => '9990f46d', 11 11 'core.pkg.js' => 'a2f2598e', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => 'bb338e4b', ··· 37 37 'rsrc/css/application/base/main-menu-view.css' => '663e3810', 38 38 'rsrc/css/application/base/notification-menu.css' => '3c9d8aa1', 39 39 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 40 - 'rsrc/css/application/base/standard-page-view.css' => '2acd4611', 40 + 'rsrc/css/application/base/standard-page-view.css' => '61e68a55', 41 41 'rsrc/css/application/chatlog/chatlog.css' => '852140ff', 42 42 'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4', 43 43 'rsrc/css/application/config/config-options.css' => '7fedf08b', ··· 731 731 'phabricator-side-menu-view-css' => 'c1db9e9c', 732 732 'phabricator-slowvote-css' => '266df6a1', 733 733 'phabricator-source-code-view-css' => '2ceee894', 734 - 'phabricator-standard-page-view' => '2acd4611', 734 + 'phabricator-standard-page-view' => '61e68a55', 735 735 'phabricator-textareautils' => '5c93c52c', 736 736 'phabricator-title' => 'df5e11d2', 737 737 'phabricator-tooltip' => '1d298e3a',
-2
src/__phutil_library_map__.php
··· 2143 2143 'PhabricatorOAuthServerTokenController' => 'applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php', 2144 2144 'PhabricatorObjectHandle' => 'applications/phid/PhabricatorObjectHandle.php', 2145 2145 'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/PhabricatorObjectHandleConstants.php', 2146 - 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php', 2147 2146 'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaSubtaskEdgeType.php', 2148 2147 'PhabricatorObjectHasAsanaTaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaTaskEdgeType.php', 2149 2148 'PhabricatorObjectHasContributorEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasContributorEdgeType.php', ··· 5549 5548 'PhabricatorOAuthServerTestController' => 'PhabricatorOAuthServerController', 5550 5549 'PhabricatorOAuthServerTokenController' => 'PhabricatorAuthController', 5551 5550 'PhabricatorObjectHandle' => 'PhabricatorPolicyInterface', 5552 - 'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants', 5553 5551 'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'PhabricatorEdgeType', 5554 5552 'PhabricatorObjectHasAsanaTaskEdgeType' => 'PhabricatorEdgeType', 5555 5553 'PhabricatorObjectHasContributorEdgeType' => 'PhabricatorEdgeType',
+1 -1
src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php
··· 42 42 ->setURI('/E'.$id); 43 43 44 44 if ($is_cancelled) { 45 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 45 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 46 46 } 47 47 } 48 48 }
+1 -1
src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php
··· 36 36 $handle->setURI("/{$monogram}"); 37 37 38 38 if ($panel->getIsArchived()) { 39 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 39 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 40 40 } 41 41 } 42 42 }
+1 -1
src/applications/differential/phid/DifferentialRevisionPHIDType.php
··· 41 41 $handle->setFullName("D{$id}: {$title}"); 42 42 43 43 if ($revision->isClosed()) { 44 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 44 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 45 45 } 46 46 } 47 47 }
+1 -1
src/applications/flag/query/PhabricatorFlagSearchEngine.php
··· 152 152 ->setHeader($flag->getHandle()->getFullName()) 153 153 ->setHref($flag->getHandle()->getURI()); 154 154 155 - $status_open = PhabricatorObjectHandleStatus::STATUS_OPEN; 155 + $status_open = PhabricatorObjectHandle::STATUS_OPEN; 156 156 if ($flag->getHandle()->getStatus() != $status_open) { 157 157 $item->setDisabled(true); 158 158 }
+1 -1
src/applications/fund/phid/FundInitiativePHIDType.php
··· 37 37 $name = $initiative->getName(); 38 38 39 39 if ($initiative->isClosed()) { 40 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 40 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 41 41 } 42 42 43 43 $handle->setName($name);
+1 -1
src/applications/maniphest/phid/ManiphestTaskPHIDType.php
··· 39 39 $handle->setURI("/T{$id}"); 40 40 41 41 if ($task->isClosed()) { 42 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 42 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 43 43 } 44 44 } 45 45 }
+1 -1
src/applications/passphrase/phid/PassphraseCredentialPHIDType.php
··· 39 39 $handle->setURI("/K{$id}"); 40 40 41 41 if ($credential->getIsDestroyed()) { 42 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 42 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 43 43 } 44 44 } 45 45 }
+22 -5
src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
··· 43 43 $handle->setURI('/p/'.$user->getUsername().'/'); 44 44 $handle->setFullName($user->getFullName()); 45 45 $handle->setImageURI($user->getProfileImageURI()); 46 - $handle->setDisabled(!$user->isUserActivated()); 47 - if ($user->hasStatus()) { 48 - $status = $user->getStatus(); 49 - $handle->setStatus($status->getTextStatus()); 50 - $handle->setTitle($status->getTerseSummary($query->getViewer())); 46 + 47 + $availability = null; 48 + if (!$user->isUserActivated()) { 49 + $availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; 50 + } else { 51 + if ($user->hasStatus()) { 52 + // NOTE: This first call returns an event; then we get the event 53 + // status. 54 + $status = $user->getStatus()->getStatus(); 55 + switch ($status) { 56 + case PhabricatorCalendarEvent::STATUS_AWAY: 57 + $availability = PhabricatorObjectHandle::AVAILABILITY_NONE; 58 + break; 59 + case PhabricatorCalendarEvent::STATUS_SPORADIC: 60 + $availability = PhabricatorObjectHandle::AVAILABILITY_PARTIAL; 61 + break; 62 + } 63 + } 64 + } 65 + 66 + if ($availability) { 67 + $handle->setAvailability($availability); 51 68 } 52 69 } 53 70 }
+26 -34
src/applications/phid/PhabricatorObjectHandle.php
··· 3 3 final class PhabricatorObjectHandle 4 4 implements PhabricatorPolicyInterface { 5 5 6 + const AVAILABILITY_FULL = 'full'; 7 + const AVAILABILITY_NONE = 'none'; 8 + const AVAILABILITY_PARTIAL = 'partial'; 9 + const AVAILABILITY_DISABLED = 'disabled'; 10 + 11 + const STATUS_OPEN = 'open'; 12 + const STATUS_CLOSED = 'closed'; 13 + 6 14 private $uri; 7 15 private $phid; 8 16 private $type; ··· 13 21 private $icon; 14 22 private $tagColor; 15 23 private $timestamp; 16 - private $status = PhabricatorObjectHandleStatus::STATUS_OPEN; 24 + private $status = self::STATUS_OPEN; 25 + private $availability = self::AVAILABILITY_FULL; 17 26 private $complete; 18 - private $disabled; 19 27 private $objectName; 20 28 private $policyFiltered; 21 29 ··· 129 137 return $this->name; 130 138 } 131 139 140 + public function setAvailability($availability) { 141 + $this->availability = $availability; 142 + return $this; 143 + } 144 + 145 + public function getAvailability() { 146 + return $this->availability; 147 + } 148 + 149 + public function isDisabled() { 150 + return ($this->getAvailability() == self::AVAILABILITY_DISABLED); 151 + } 152 + 132 153 public function setStatus($status) { 133 154 $this->status = $status; 134 155 return $this; ··· 225 246 } 226 247 227 248 228 - /** 229 - * Set whether or not the underlying object is disabled. See 230 - * @{method:isDisabled} for an explanation of what it means to be disabled. 231 - * 232 - * @param bool True if the handle represents a disabled object. 233 - * @return this 234 - */ 235 - public function setDisabled($disabled) { 236 - $this->disabled = $disabled; 237 - return $this; 238 - } 239 - 240 - 241 - /** 242 - * Determine if the handle represents an object which has been disabled -- 243 - * for example, disabled users, archived projects, etc. These objects are 244 - * complete and exist, but should be excluded from some system interactions 245 - * (for instance, they usually should not appear in typeaheads, and should 246 - * not have mail/notifications delivered to or about them). 247 - * 248 - * @return bool True if the handle represents a disabled object. 249 - */ 250 - public function isDisabled() { 251 - return $this->disabled; 252 - } 253 - 254 - 255 249 public function renderLink($name = null) { 256 250 if ($name === null) { 257 251 $name = $this->getLinkName(); ··· 260 254 $classes[] = 'phui-handle'; 261 255 $title = $this->title; 262 256 263 - if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { 257 + if ($this->status != self::STATUS_OPEN) { 264 258 $classes[] = 'handle-status-'.$this->status; 265 - $title = $title ? $title : $this->status; 266 259 } 267 260 268 - if ($this->disabled) { 269 - $classes[] = 'handle-disabled'; 270 - $title = pht('Disabled'); // Overwrite status. 261 + if ($this->availability != self::AVAILABILITY_FULL) { 262 + $classes[] = 'handle-availability-'.$this->availability; 271 263 } 272 264 273 265 if ($this->getType() == PhabricatorPeopleUserPHIDType::TYPECONST) {
-9
src/applications/phid/handle/const/PhabricatorObjectHandleStatus.php
··· 1 - <?php 2 - 3 - final class PhabricatorObjectHandleStatus 4 - extends PhabricatorObjectHandleConstants { 5 - 6 - const STATUS_OPEN = 'open'; 7 - const STATUS_CLOSED = 'closed'; 8 - 9 - }
+1 -1
src/applications/pholio/phid/PholioMockPHIDType.php
··· 40 40 $handle->setFullName("M{$id}: {$name}"); 41 41 42 42 if ($mock->isClosed()) { 43 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 43 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 44 44 } 45 45 } 46 46 }
+1 -1
src/applications/phriction/phid/PhrictionDocumentPHIDType.php
··· 42 42 $handle->setURI(PhrictionDocument::getSlugURI($slug)); 43 43 44 44 if ($status != PhrictionDocumentStatus::STATUS_EXISTS) { 45 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 45 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 46 46 } 47 47 } 48 48 }
+4 -1
src/applications/project/phid/PhabricatorProjectColumnPHIDType.php
··· 34 34 35 35 $handle->setName($column->getDisplayName()); 36 36 $handle->setURI('/project/board/'.$column->getProject()->getID().'/'); 37 - $handle->setDisabled($column->isHidden()); 37 + 38 + if ($column->isHidden()) { 39 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 40 + } 38 41 } 39 42 } 40 43
+1 -1
src/applications/project/phid/PhabricatorProjectProjectPHIDType.php
··· 49 49 $handle->setTagColor($project->getColor()); 50 50 51 51 if ($project->isArchived()) { 52 - $handle->setStatus(PhabricatorObjectHandleStatus::STATUS_CLOSED); 52 + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 53 53 } 54 54 } 55 55 }
+1 -1
src/applications/search/view/PhabricatorSearchResultView.php
··· 41 41 ->setImageURI($handle->getImageURI()) 42 42 ->addAttribute($type_name); 43 43 44 - if ($handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { 44 + if ($handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { 45 45 $item->setDisabled(true); 46 46 $item->addAttribute(pht('Closed')); 47 47 }
+1 -1
src/applications/typeahead/view/PhabricatorTypeaheadTokenView.php
··· 35 35 ->setIcon($handle->getIcon()); 36 36 37 37 if ($handle->isDisabled() || 38 - $handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { 38 + $handle->getStatus() == PhabricatorObjectHandle::STATUS_CLOSED) { 39 39 $token->setTokenType(self::TYPE_DISABLED); 40 40 } else { 41 41 $token->setColor($handle->getTagColor());
+3 -3
src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
··· 86 86 87 87 $href = $this->getObjectHref($object, $handle, $id); 88 88 $text = $this->getObjectNamePrefix().$id; 89 - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; 89 + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; 90 90 91 91 if ($anchor) { 92 92 $href = $href.'#'.$anchor; ··· 126 126 127 127 $name = $handle->getFullName(); 128 128 $href = $handle->getURI(); 129 - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; 129 + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; 130 130 $attr = array( 131 131 'phid' => $handle->getPHID(), 132 132 'closed' => ($handle->getStatus() == $status_closed), ··· 140 140 $href, 141 141 PhabricatorObjectHandle $handle) { 142 142 143 - $status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; 143 + $status_closed = PhabricatorObjectHandle::STATUS_CLOSED; 144 144 $strikethrough = $handle->getStatus() == $status_closed ? 145 145 'text-decoration: line-through;' : 146 146 'text-decoration: none;';
+6 -6
webroot/rsrc/css/application/base/standard-page-view.css
··· 80 80 color: #19558D; 81 81 } 82 82 83 - a.handle-disabled, 84 - a.handle-status-away, 85 - a.handle-status-sporadic { 83 + a.handle-availability-disabled, 84 + a.handle-availability-none, 85 + a.handle-availability-partial { 86 86 padding-left: 11px; 87 87 background-repeat: no-repeat; 88 88 background-position: -4px center; 89 89 } 90 90 91 - a.handle-status-away { 91 + a.handle-availability-none { 92 92 background-image: url(/rsrc/image/icon/fatcow/bullet_red.png); 93 93 } 94 94 95 - a.handle-status-sporadic { 95 + a.handle-availability-partial { 96 96 background-image: url(/rsrc/image/icon/fatcow/bullet_orange.png); 97 97 } 98 98 99 - a.handle-disabled { 99 + a.handle-availability-disabled { 100 100 background-image: url(/rsrc/image/icon/fatcow/bullet_black.png); 101 101 } 102 102