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

New People Hovercards

Summary: Mimics the Project Hovercards, more custom UI.

Test Plan: Hover over person with and without badges, hover over project.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+169 -67
+2 -2
resources/celerity/map.php
··· 93 93 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 94 94 'rsrc/css/application/policy/policy.css' => '957ea14c', 95 95 'rsrc/css/application/ponder/ponder-view.css' => '7b0df4da', 96 - 'rsrc/css/application/project/project-card-view.css' => '9c3631e5', 96 + 'rsrc/css/application/project/project-card-view.css' => '9418c97d', 97 97 'rsrc/css/application/project/project-view.css' => '4693497c', 98 98 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 99 99 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', ··· 854 854 'policy-edit-css' => '815c66f7', 855 855 'policy-transaction-detail-css' => '82100a43', 856 856 'ponder-view-css' => '7b0df4da', 857 - 'project-card-view-css' => '9c3631e5', 857 + 'project-card-view-css' => '9418c97d', 858 858 'project-view-css' => '4693497c', 859 859 'releeph-core' => '9b3c5733', 860 860 'releeph-preview-branch' => 'b7a6f4a5',
+4 -2
src/__phutil_library_map__.php
··· 2904 2904 'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php', 2905 2905 'PhabricatorProjectHeraldAdapter' => 'applications/project/herald/PhabricatorProjectHeraldAdapter.php', 2906 2906 'PhabricatorProjectHeraldFieldGroup' => 'applications/project/herald/PhabricatorProjectHeraldFieldGroup.php', 2907 + 'PhabricatorProjectHovercardEngineExtension' => 'applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php', 2907 2908 'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php', 2908 2909 'PhabricatorProjectIconsConfigOptionType' => 'applications/project/config/PhabricatorProjectIconsConfigOptionType.php', 2909 2910 'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php', ··· 3376 3377 'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php', 3377 3378 'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php', 3378 3379 'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php', 3380 + 'PhabricatorUserCardView' => 'applications/people/view/PhabricatorUserCardView.php', 3379 3381 'PhabricatorUserConfigOptions' => 'applications/people/config/PhabricatorUserConfigOptions.php', 3380 3382 'PhabricatorUserConfiguredCustomField' => 'applications/people/customfield/PhabricatorUserConfiguredCustomField.php', 3381 3383 'PhabricatorUserConfiguredCustomFieldStorage' => 'applications/people/storage/PhabricatorUserConfiguredCustomFieldStorage.php', ··· 3828 3830 'ProjectDefaultJoinCapability' => 'applications/project/capability/ProjectDefaultJoinCapability.php', 3829 3831 'ProjectDefaultViewCapability' => 'applications/project/capability/ProjectDefaultViewCapability.php', 3830 3832 'ProjectEditConduitAPIMethod' => 'applications/project/conduit/ProjectEditConduitAPIMethod.php', 3831 - 'ProjectHovercardEngineExtension' => 'applications/project/events/ProjectHovercardEngineExtension.php', 3832 3833 'ProjectQueryConduitAPIMethod' => 'applications/project/conduit/ProjectQueryConduitAPIMethod.php', 3833 3834 'ProjectRemarkupRule' => 'applications/project/remarkup/ProjectRemarkupRule.php', 3834 3835 'ProjectRemarkupRuleTestCase' => 'applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php', ··· 7338 7339 'PhabricatorProjectHeraldAction' => 'HeraldAction', 7339 7340 'PhabricatorProjectHeraldAdapter' => 'HeraldAdapter', 7340 7341 'PhabricatorProjectHeraldFieldGroup' => 'HeraldFieldGroup', 7342 + 'PhabricatorProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 7341 7343 'PhabricatorProjectIconSet' => 'PhabricatorIconSet', 7342 7344 'PhabricatorProjectIconsConfigOptionType' => 'PhabricatorConfigJSONOptionType', 7343 7345 'PhabricatorProjectListController' => 'PhabricatorProjectController', ··· 7887 7889 'PhabricatorFulltextInterface', 7888 7890 ), 7889 7891 'PhabricatorUserBlurbField' => 'PhabricatorUserCustomField', 7892 + 'PhabricatorUserCardView' => 'AphrontTagView', 7890 7893 'PhabricatorUserConfigOptions' => 'PhabricatorApplicationConfigOptions', 7891 7894 'PhabricatorUserConfiguredCustomField' => array( 7892 7895 'PhabricatorUserCustomField', ··· 8474 8477 'ProjectDefaultJoinCapability' => 'PhabricatorPolicyCapability', 8475 8478 'ProjectDefaultViewCapability' => 'PhabricatorPolicyCapability', 8476 8479 'ProjectEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 8477 - 'ProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 8478 8480 'ProjectQueryConduitAPIMethod' => 'ProjectConduitAPIMethod', 8479 8481 'ProjectRemarkupRule' => 'PhabricatorObjectRemarkupRule', 8480 8482 'ProjectRemarkupRuleTestCase' => 'PhabricatorTestCase',
+5 -61
src/applications/people/engineextension/PeopleHovercardEngineExtension.php
··· 25 25 ->setViewer($viewer) 26 26 ->withPHIDs($phids) 27 27 ->needAvailability(true) 28 + ->needProfileImage(true) 28 29 ->needProfile(true) 29 30 ->needBadges(true) 30 31 ->execute(); ··· 47 48 return; 48 49 } 49 50 50 - $hovercard->setTitle($user->getUsername()); 51 - 52 - $profile = $user->getUserProfile(); 53 - $detail = $user->getRealName(); 54 - if ($profile->getTitle()) { 55 - $detail .= ' - '.$profile->getTitle(); 56 - } 57 - $hovercard->setDetail($detail); 58 - 59 - if ($user->getIsDisabled()) { 60 - $hovercard->addField(pht('Account'), pht('Disabled')); 61 - } else if (!$user->isUserActivated()) { 62 - $hovercard->addField(pht('Account'), pht('Not Activated')); 63 - } else if (PhabricatorApplication::isClassInstalledForViewer( 64 - 'PhabricatorCalendarApplication', 65 - $viewer)) { 66 - $hovercard->addField( 67 - pht('Status'), 68 - $user->getAvailabilityDescription($viewer)); 69 - } 70 - 71 - $hovercard->addField( 72 - pht('User Since'), 73 - phabricator_date($user->getDateCreated(), $viewer)); 74 - 75 - if ($profile->getBlurb()) { 76 - $hovercard->addField(pht('Blurb'), 77 - id(new PhutilUTF8StringTruncator()) 78 - ->setMaximumGlyphs(120) 79 - ->truncateString($profile->getBlurb())); 80 - } 81 - 82 - $badges = $this->buildBadges($user, $viewer); 83 - foreach ($badges as $badge) { 84 - $hovercard->addBadge($badge); 85 - } 86 - } 51 + $user_card = id(new PhabricatorUserCardView()) 52 + ->setProfile($user) 53 + ->setViewer($viewer); 87 54 88 - private function buildBadges( 89 - PhabricatorUser $user, 90 - $viewer) { 55 + $hovercard->appendChild($user_card); 91 56 92 - $class = 'PhabricatorBadgesApplication'; 93 - $items = array(); 94 - 95 - if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 96 - $badge_phids = $user->getBadgePHIDs(); 97 - if ($badge_phids) { 98 - $badges = id(new PhabricatorBadgesQuery()) 99 - ->setViewer($viewer) 100 - ->withPHIDs($badge_phids) 101 - ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE)) 102 - ->execute(); 103 - 104 - foreach ($badges as $badge) { 105 - $items[] = id(new PHUIBadgeMiniView()) 106 - ->setIcon($badge->getIcon()) 107 - ->setHeader($badge->getName()) 108 - ->setQuality($badge->getQuality()); 109 - } 110 - } 111 - } 112 - return $items; 113 57 } 114 58 115 59 }
+151
src/applications/people/view/PhabricatorUserCardView.php
··· 1 + <?php 2 + 3 + final class PhabricatorUserCardView extends AphrontTagView { 4 + 5 + private $profile; 6 + private $viewer; 7 + private $tag; 8 + 9 + public function setProfile(PhabricatorUser $profile) { 10 + $this->profile = $profile; 11 + return $this; 12 + } 13 + 14 + public function setViewer(PhabricatorUser $viewer) { 15 + $this->viewer = $viewer; 16 + return $this; 17 + } 18 + 19 + public function setTag($tag) { 20 + $this->tag = $tag; 21 + return $this; 22 + } 23 + 24 + protected function getTagName() { 25 + if ($this->tag) { 26 + return $this->tag; 27 + } 28 + return 'div'; 29 + } 30 + 31 + protected function getTagAttributes() { 32 + $classes = array(); 33 + $classes[] = 'project-card-view'; 34 + 35 + if ($this->profile->getIsDisabled()) { 36 + $classes[] = 'project-card-grey'; 37 + } else { 38 + $classes[] = 'project-card-blue'; 39 + } 40 + 41 + return array( 42 + 'class' => implode($classes, ' '), 43 + ); 44 + } 45 + 46 + protected function getTagContent() { 47 + 48 + $user = $this->profile; 49 + $profile = $user->loadUserProfile(); 50 + $picture = $user->getProfileImageURI(); 51 + $viewer = $this->viewer; 52 + 53 + require_celerity_resource('project-card-view-css'); 54 + 55 + $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon()); 56 + $profile_title = $profile->getDisplayTitle(); 57 + 58 + $tag = id(new PHUITagView()) 59 + ->setIcon($profile_icon) 60 + ->setName($profile_title) 61 + ->addClass('project-view-header-tag') 62 + ->setType(PHUITagView::TYPE_SHADE); 63 + 64 + $header = id(new PHUIHeaderView()) 65 + ->setHeader(array($user->getFullName(), $tag)) 66 + ->setUser($viewer) 67 + ->setImage($picture); 68 + 69 + $body = array(); 70 + 71 + $body[] = $this->addItem( 72 + pht('User Since'), 73 + phabricator_date($profile->getDateCreated(), $viewer)); 74 + 75 + if (PhabricatorApplication::isClassInstalledForViewer( 76 + 'PhabricatorCalendarApplication', 77 + $viewer)) { 78 + $availability = $user->getAvailabilityDescription($viewer); 79 + $body[] = $this->addItem(pht('Status'), $availability); 80 + } 81 + 82 + $badges = $this->buildBadges($user, $viewer); 83 + if ($badges) { 84 + $badges = id(new PHUIBadgeBoxView()) 85 + ->addItems($badges) 86 + ->setCollapsed(true); 87 + $body[] = phutil_tag( 88 + 'div', 89 + array( 90 + 'class' => 'phui-hovercard-body-item hovercard-badges', 91 + ), 92 + $badges); 93 + } 94 + 95 + $body = phutil_tag( 96 + 'div', 97 + array( 98 + 'class' => 'project-card-body', 99 + ), 100 + $body); 101 + 102 + $card = phutil_tag( 103 + 'div', 104 + array( 105 + 'class' => 'project-card-inner', 106 + ), 107 + array( 108 + $header, 109 + $body, 110 + )); 111 + 112 + return $card; 113 + } 114 + 115 + private function addItem($label, $value) { 116 + $item = array( 117 + phutil_tag('strong', array(), $label), 118 + ': ', 119 + phutil_tag('span', array(), $value), 120 + ); 121 + return phutil_tag_div('project-card-item', $item); 122 + } 123 + 124 + private function buildBadges( 125 + PhabricatorUser $user, 126 + $viewer) { 127 + 128 + $class = 'PhabricatorBadgesApplication'; 129 + $items = array(); 130 + 131 + if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 132 + $badge_phids = $user->getBadgePHIDs(); 133 + if ($badge_phids) { 134 + $badges = id(new PhabricatorBadgesQuery()) 135 + ->setViewer($viewer) 136 + ->withPHIDs($badge_phids) 137 + ->withStatuses(array(PhabricatorBadgesBadge::STATUS_ACTIVE)) 138 + ->execute(); 139 + 140 + foreach ($badges as $badge) { 141 + $items[] = id(new PHUIBadgeMiniView()) 142 + ->setIcon($badge->getIcon()) 143 + ->setHeader($badge->getName()) 144 + ->setQuality($badge->getQuality()); 145 + } 146 + } 147 + } 148 + return $items; 149 + } 150 + 151 + }
+1 -1
src/applications/project/events/ProjectHovercardEngineExtension.php src/applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php
··· 1 1 <?php 2 2 3 - final class ProjectHovercardEngineExtension 3 + final class PhabricatorProjectHovercardEngineExtension 4 4 extends PhabricatorHovercardEngineExtension { 5 5 6 6 const EXTENSIONKEY = 'project.card';
+6 -1
webroot/rsrc/css/application/project/project-card-view.css
··· 14 14 15 15 .project-card-view .phui-header-shell { 16 16 margin: 0; 17 - padding: 12px 12px 16px 12px; 17 + padding: 12px 12px 4px 12px; 18 18 border: none; 19 19 border-radius: 3px; 20 20 } ··· 43 43 .project-card-view .phui-header-subheader { 44 44 font-size: {$normalfontsize}; 45 45 margin-top: 12px; 46 + padding-bottom: 12px; 46 47 } 47 48 48 49 .project-card-view .phui-header-header .phui-tag-view { ··· 63 64 color: {$bluetext}; 64 65 } 65 66 67 + .project-card-view .project-card-body { 68 + padding: 0 12px 12px 76px; 69 + color: {$darkbluetext}; 70 + } 66 71 67 72 /* Colors */ 68 73