diff options
author | Anna Larch <anna@nextcloud.com> | 2021-07-07 12:45:00 +0300 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2021-07-12 16:03:34 +0300 |
commit | 6d44305d0f1133f15d2b7fabad1a5919d4b43546 (patch) | |
tree | 820954e99f3377e1ec785b8877a7e5214e4a1cff /lib/Service | |
parent | 4ecb5a1f060a5a8f25722d0676f8b67b005cbbd6 (diff) |
Move userId to controller
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/AvatarService.php | 6 | ||||
-rw-r--r-- | lib/Service/UserPreferenceService.php (renamed from lib/Service/UserPreferenceSevice.php) | 20 |
2 files changed, 12 insertions, 14 deletions
diff --git a/lib/Service/AvatarService.php b/lib/Service/AvatarService.php index 71473ae24..03e9a2c8b 100644 --- a/lib/Service/AvatarService.php +++ b/lib/Service/AvatarService.php @@ -77,8 +77,8 @@ class AvatarService implements IAvatarService { /** * @return bool */ - private function externalAvatarsAllowed(): bool { - return $this->preferences->getPreference('external-avatars', 'true') === 'true'; + private function externalAvatarsAllowed(string $uid): bool { + return $this->preferences->getPreference($uid, 'external-avatars', 'true') === 'true'; } /** @@ -115,7 +115,7 @@ class AvatarService implements IAvatarService { return null; } - $avatar = $this->source->fetch($email, $this->avatarFactory, $this->externalAvatarsAllowed()); + $avatar = $this->source->fetch($email, $this->avatarFactory, $this->externalAvatarsAllowed($uid)); if (is_null($avatar) || !$this->hasAllowedMime($avatar)) { // Cannot locate any avatar -> nothing to do here diff --git a/lib/Service/UserPreferenceSevice.php b/lib/Service/UserPreferenceService.php index aff05ace0..192435546 100644 --- a/lib/Service/UserPreferenceSevice.php +++ b/lib/Service/UserPreferenceService.php @@ -29,38 +29,36 @@ namespace OCA\Mail\Service; use OCA\Mail\Contracts\IUserPreferences; use OCP\IConfig; -class UserPreferenceSevice implements IUserPreferences { +class UserPreferenceService implements IUserPreferences { /** @var IConfig */ private $config; - /** @var string */ - private $UserId; - /** * @param IConfig $config - * @param string $UserId */ - public function __construct(IConfig $config, $UserId) { + public function __construct(IConfig $config) { $this->config = $config; - $this->UserId = $UserId; } /** + * @param string $userId * @param string $key * @param mixed $value * @return mixed new value */ - public function setPreference($key, $value) { - $this->config->setUserValue($this->UserId, 'mail', $key, $value); + public function setPreference(string $userId, $key, $value) { + $this->config->setUserValue($userId, 'mail', $key, $value); return $value; } /** + * @param string $userId * @param string $key * @param mixed|null $default + * @return string */ - public function getPreference($key, $default = null) { - return $this->config->getUserValue($this->UserId, 'mail', $key, $default); + public function getPreference(string $userId, $key, $default = null) { + return $this->config->getUserValue($userId, 'mail', $key, $default); } } |