Page MenuHomePhabricator

D20105.diff
No OneTemporary

D20105.diff

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

Mime Type
text/plain
Expires
Mon, May 20, 5:11 AM (2 w, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6272954
Default Alt Text
D20105.diff (2 KB)

Event Timeline