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

In "External Accounts", replace hard-to-find tiny "link" icon with a nice button with text on it

Summary:
Ref T6703. Replaces the small "link" icon with a more obvious "Link External Account" button.

Moves us toward operating against `$config` objects instead of against `$provider` objects, which is more modern and will some day allow us to resolve T6703.

Test Plan: Viewed page, saw a more obvious button. Linked an external account.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T6703

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

+32 -10
+9
src/applications/auth/storage/PhabricatorAuthProviderConfig.php
··· 95 95 return $this->getProvider()->getProviderName(); 96 96 } 97 97 98 + public function getSortVector() { 99 + return id(new PhutilSortVector()) 100 + ->addString($this->getDisplayName()); 101 + } 102 + 103 + public function newIconView() { 104 + return $this->getProvider()->newIconView(); 105 + } 106 + 98 107 99 108 /* -( PhabricatorApplicationTransactionInterface )------------------------- */ 100 109
+23 -10
src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
··· 105 105 106 106 $accounts = mpull($accounts, null, 'getProviderKey'); 107 107 108 - $providers = PhabricatorAuthProvider::getAllEnabledProviders(); 109 - $providers = msort($providers, 'getProviderName'); 110 - foreach ($providers as $key => $provider) { 111 - if (isset($accounts[$key])) { 108 + $configs = id(new PhabricatorAuthProviderConfigQuery()) 109 + ->setViewer($viewer) 110 + ->withIsEnabled(true) 111 + ->execute(); 112 + $configs = msort($configs, 'getSortVector'); 113 + 114 + foreach ($configs as $config) { 115 + $provider = $config->getProvider(); 116 + 117 + if (!$provider->shouldAllowAccountLink()) { 112 118 continue; 113 119 } 114 120 115 - if (!$provider->shouldAllowAccountLink()) { 121 + // Don't show the user providers they already have linked. 122 + $provider_key = $config->getProvider()->getProviderKey(); 123 + if (isset($accounts[$provider_key])) { 116 124 continue; 117 125 } 118 126 119 127 $link_uri = '/auth/link/'.$provider->getProviderKey().'/'; 128 + 129 + $link_button = id(new PHUIButtonView()) 130 + ->setTag('a') 131 + ->setIcon('fa-link') 132 + ->setHref($link_uri) 133 + ->setColor(PHUIButtonView::GREY) 134 + ->setText(pht('Link External Account')); 120 135 121 136 $item = id(new PHUIObjectItemView()) 122 - ->setHeader($provider->getProviderName()) 137 + ->setHeader($config->getDisplayName()) 123 138 ->setHref($link_uri) 124 - ->addAction( 125 - id(new PHUIListItemView()) 126 - ->setIcon('fa-link') 127 - ->setHref($link_uri)); 139 + ->setImageIcon($config->newIconView()) 140 + ->setSideColumn($link_button); 128 141 129 142 $linkable->addItem($item); 130 143 }