Differential D20105 Diff 48025 src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
| Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public function processRequest(AphrontRequest $request) { | ||||
| $linkable = id(new PHUIObjectItemListView()) | $linkable = id(new PHUIObjectItemListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setNoDataString( | ->setNoDataString( | ||||
| pht('Your account is linked with all available providers.')); | pht('Your account is linked with all available providers.')); | ||||
| $accounts = mpull($accounts, null, 'getProviderKey'); | $accounts = mpull($accounts, null, 'getProviderKey'); | ||||
| $providers = PhabricatorAuthProvider::getAllEnabledProviders(); | $configs = id(new PhabricatorAuthProviderConfigQuery()) | ||||
| $providers = msort($providers, 'getProviderName'); | ->setViewer($viewer) | ||||
| foreach ($providers as $key => $provider) { | ->withIsEnabled(true) | ||||
| if (isset($accounts[$key])) { | ->execute(); | ||||
| $configs = msort($configs, 'getSortVector'); | |||||
| foreach ($configs as $config) { | |||||
| $provider = $config->getProvider(); | |||||
| if (!$provider->shouldAllowAccountLink()) { | |||||
| continue; | continue; | ||||
| } | } | ||||
| if (!$provider->shouldAllowAccountLink()) { | // Don't show the user providers they already have linked. | ||||
| $provider_key = $config->getProvider()->getProviderKey(); | |||||
| if (isset($accounts[$provider_key])) { | |||||
amckinley: "have a linked" | |||||
| continue; | continue; | ||||
| } | } | ||||
| $link_uri = '/auth/link/'.$provider->getProviderKey().'/'; | $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()) | $item = id(new PHUIObjectItemView()) | ||||
| ->setHeader($provider->getProviderName()) | ->setHeader($config->getDisplayName()) | ||||
| ->setHref($link_uri) | ->setHref($link_uri) | ||||
| ->addAction( | ->setImageIcon($config->newIconView()) | ||||
| id(new PHUIListItemView()) | ->setSideColumn($link_button); | ||||
| ->setIcon('fa-link') | |||||
| ->setHref($link_uri)); | |||||
| $linkable->addItem($item); | $linkable->addItem($item); | ||||
| } | } | ||||
| $linked_box = $this->newBox($linked_head, $linked); | $linked_box = $this->newBox($linked_head, $linked); | ||||
| $linkable_box = $this->newBox($linkable_head, $linkable); | $linkable_box = $this->newBox($linkable_head, $linkable); | ||||
| return array( | return array( | ||||
| $linked_box, | $linked_box, | ||||
| $linkable_box, | $linkable_box, | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
"have a linked"