diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-04 14:30:12 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-04 14:56:49 +0100 |
commit | a619629ac0e026fa938b45eeb82ea2a7ebe35aa2 (patch) | |
tree | edfc4ea5311393efab271f76fb662393587ba10c /settings/controller/userscontroller.php | |
parent | e91eba4b5bd856cb1ef81996ace6d16c09f1bb01 (diff) | |
download | nextcloud-server-a619629ac0e026fa938b45eeb82ea2a7ebe35aa2.tar.gz nextcloud-server-a619629ac0e026fa938b45eeb82ea2a7ebe35aa2.zip |
Only try to load avatars in the user list if there is any
Diffstat (limited to 'settings/controller/userscontroller.php')
-rw-r--r-- | settings/controller/userscontroller.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/settings/controller/userscontroller.php b/settings/controller/userscontroller.php index 827f74c4c83..0164d3bcee7 100644 --- a/settings/controller/userscontroller.php +++ b/settings/controller/userscontroller.php @@ -43,6 +43,7 @@ use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; use OCP\Mail\IMailer; +use OCP\IAvatarManager; /** * @package OC\Settings\Controller @@ -74,6 +75,8 @@ class UsersController extends Controller { private $isEncryptionAppEnabled; /** @var bool contains the state of the admin recovery setting */ private $isRestoreEnabled = false; + /** @var IAvatarManager */ + private $avatarManager; /** * @param string $appName @@ -104,7 +107,8 @@ class UsersController extends Controller { IMailer $mailer, $fromMailAddress, IURLGenerator $urlGenerator, - IAppManager $appManager) { + IAppManager $appManager, + IAvatarManager $avatarManager) { parent::__construct($appName, $request); $this->userManager = $userManager; $this->groupManager = $groupManager; @@ -117,6 +121,7 @@ class UsersController extends Controller { $this->mailer = $mailer; $this->fromMailAddress = $fromMailAddress; $this->urlGenerator = $urlGenerator; + $this->avatarManager = $avatarManager; // check for encryption state - TODO see formatUserForIndex $this->isEncryptionAppEnabled = $appManager->isEnabledForUser('encryption'); @@ -168,6 +173,12 @@ class UsersController extends Controller { if (is_null($displayName)) { $displayName = ''; } + + $avatarAvailable = false; + if ($this->config->getSystemValue('enable_avatars', true) === true) { + $avatarAvailable = $this->avatarManager->getAvatar($user->getUID())->exists(); + } + return [ 'name' => $user->getUID(), 'displayname' => $user->getDisplayName(), @@ -179,6 +190,7 @@ class UsersController extends Controller { 'backend' => $user->getBackendClassName(), 'email' => $displayName, 'isRestoreDisabled' => !$restorePossible, + 'isAvatarAvailable' => $avatarAvailable, ]; } |