diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-11-14 14:52:05 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-11-21 12:11:57 +0300 |
commit | a805c8319f6f13dce845ad48d989e71cdc7610af (patch) | |
tree | ade2ae7dbd9410bb47d5ad6151766cbc60d12d64 /lib | |
parent | 8e8b9748486424825be0ab202b7fed05fb66749f (diff) |
Add external avatars
* Memoize avatar url fetching promise for simple functional caching
* Add extern avatars settings checkbox
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Contracts/IUserPreferences.php | 1 | ||||
-rw-r--r-- | lib/Controller/PreferencesController.php | 6 | ||||
-rw-r--r-- | lib/Service/UserPreferenceSevice.php | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/lib/Contracts/IUserPreferences.php b/lib/Contracts/IUserPreferences.php index d953f461e..efaed8e45 100644 --- a/lib/Contracts/IUserPreferences.php +++ b/lib/Contracts/IUserPreferences.php @@ -31,6 +31,7 @@ interface IUserPreferences { /** * @param string $key * @param mixed $value + * @return mixed new value */ public function setPreference($key, $value); diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php index 9a5db350e..1e00a118d 100644 --- a/lib/Controller/PreferencesController.php +++ b/lib/Controller/PreferencesController.php @@ -74,9 +74,11 @@ class PreferencesController extends Controller { throw new ClientException('key or value missing'); } - $this->userPreference->setPreference($key, $value); + $newValue = $this->userPreference->setPreference($key, $value); - return new JSONResponse(); + return new JSONResponse([ + 'value' => $newValue, + ]); } } diff --git a/lib/Service/UserPreferenceSevice.php b/lib/Service/UserPreferenceSevice.php index 5f45c8438..43614361c 100644 --- a/lib/Service/UserPreferenceSevice.php +++ b/lib/Service/UserPreferenceSevice.php @@ -24,6 +24,7 @@ namespace OCA\Mail\Service; +use function is_bool; use OCA\Mail\Contracts\IUserPreferences; use OCP\IConfig; @@ -47,9 +48,11 @@ class UserPreferenceSevice implements IUserPreferences { /** * @param string $key * @param mixed $value + * @return mixed new value */ public function setPreference($key, $value) { $this->config->setUserValue($this->UserId, 'mail', $key, $value); + return $value; } /** |