Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/query/PhabricatorExternalAccountQuery.php
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function newResultObject() { | ||||
return new PhabricatorExternalAccount(); | return new PhabricatorExternalAccount(); | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
return $this->loadStandardPage($this->newResultObject()); | return $this->loadStandardPage($this->newResultObject()); | ||||
} | } | ||||
protected function willFilterPage(array $accounts) { | protected function willFilterPage(array $accounts) { | ||||
$viewer = $this->getViewer(); | |||||
$configs = id(new PhabricatorAuthProviderConfigQuery()) | |||||
->setViewer($viewer) | |||||
->withPHIDs(mpull($accounts, 'getProviderConfigPHID')) | |||||
->execute(); | |||||
$configs = mpull($configs, null, 'getPHID'); | |||||
foreach ($accounts as $key => $account) { | |||||
$config_phid = $account->getProviderConfigPHID(); | |||||
$config = idx($configs, $config_phid); | |||||
if (!$config) { | |||||
unset($accounts[$key]); | |||||
continue; | |||||
} | |||||
$account->attachProviderConfig($config); | |||||
} | |||||
if ($this->needImages) { | if ($this->needImages) { | ||||
$file_phids = mpull($accounts, 'getProfileImagePHID'); | $file_phids = mpull($accounts, 'getProfileImagePHID'); | ||||
$file_phids = array_filter($file_phids); | $file_phids = array_filter($file_phids); | ||||
if ($file_phids) { | if ($file_phids) { | ||||
// NOTE: We use the omnipotent viewer here because these files are | // NOTE: We use the omnipotent viewer here because these files are | ||||
// usually created during registration and can't be associated with | // usually created during registration and can't be associated with | ||||
// the correct policies, since the relevant user account does not exist | // the correct policies, since the relevant user account does not exist | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |