Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15420808
D20105.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D20105.diff
View Options
diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
--- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
+++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
@@ -95,6 +95,15 @@
return $this->getProvider()->getProviderName();
}
+ public function getSortVector() {
+ return id(new PhutilSortVector())
+ ->addString($this->getDisplayName());
+ }
+
+ public function newIconView() {
+ return $this->getProvider()->newIconView();
+ }
+
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
diff --git a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
@@ -105,26 +105,39 @@
$accounts = mpull($accounts, null, 'getProviderKey');
- $providers = PhabricatorAuthProvider::getAllEnabledProviders();
- $providers = msort($providers, 'getProviderName');
- foreach ($providers as $key => $provider) {
- if (isset($accounts[$key])) {
+ $configs = id(new PhabricatorAuthProviderConfigQuery())
+ ->setViewer($viewer)
+ ->withIsEnabled(true)
+ ->execute();
+ $configs = msort($configs, 'getSortVector');
+
+ foreach ($configs as $config) {
+ $provider = $config->getProvider();
+
+ if (!$provider->shouldAllowAccountLink()) {
continue;
}
- if (!$provider->shouldAllowAccountLink()) {
+ // Don't show the user providers they already have linked.
+ $provider_key = $config->getProvider()->getProviderKey();
+ if (isset($accounts[$provider_key])) {
continue;
}
$link_uri = '/auth/link/'.$provider->getProviderKey().'/';
+ $link_button = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon('fa-link')
+ ->setHref($link_uri)
+ ->setColor(PHUIButtonView::GREY)
+ ->setText(pht('Link External Account'));
+
$item = id(new PHUIObjectItemView())
- ->setHeader($provider->getProviderName())
+ ->setHeader($config->getDisplayName())
->setHref($link_uri)
- ->addAction(
- id(new PHUIListItemView())
- ->setIcon('fa-link')
- ->setHref($link_uri));
+ ->setImageIcon($config->newIconView())
+ ->setSideColumn($link_button);
$linkable->addItem($item);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 22, 5:51 PM (19 h, 11 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7717252
Default Alt Text
D20105.diff (2 KB)
Attached To
Mode
D20105: In "External Accounts", replace hard-to-find tiny "link" icon with a nice button with text on it
Attached
Detach File
Event Timeline
Log In to Comment