diff options
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/PageController.php | 9 | ||||
-rw-r--r-- | lib/Controller/PreferencesController.php | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index cff03a324..a337254e4 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -143,7 +143,7 @@ class PageController extends Controller { ); $this->initialStateService->provideInitialState( 'account-settings', - json_decode($this->preferences->getPreference('account-settings', '[]'), true, 512, JSON_THROW_ON_ERROR) ?? [] + json_decode($this->preferences->getPreference($this->currentUserId, 'account-settings', '[]'), true, 512, JSON_THROW_ON_ERROR) ?? [] ); $this->initialStateService->provideInitialState( 'tags', @@ -155,9 +155,10 @@ class PageController extends Controller { [ 'attachment-size-limit' => $this->config->getSystemValue('app.mail.attachment-size-limit', 0), 'app-version' => $this->config->getAppValue('mail', 'installed_version'), - 'external-avatars' => $this->preferences->getPreference('external-avatars', 'true'), - 'reply-mode' => $this->preferences->getPreference('reply-mode', 'top'), - 'collect-data' => $this->preferences->getPreference('collect-data', 'true'), + 'external-avatars' => $this->preferences->getPreference($this->currentUserId, 'external-avatars', 'true'), + 'reply-mode' => $this->preferences->getPreference($this->currentUserId, 'reply-mode', 'top'), + 'collect-data' => $this->preferences->getPreference($this->currentUserId, 'collect-data', 'true'), + 'tag-classified-messages' => $this->preferences->getPreference($this->currentUserId, 'tag-classified-messages', 'true'), ]); $this->initialStateService->provideInitialState( 'prefill_displayName', diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php index 201b8be38..2d0e7d3cd 100644 --- a/lib/Controller/PreferencesController.php +++ b/lib/Controller/PreferencesController.php @@ -37,14 +37,19 @@ class PreferencesController extends Controller { /** @var IUserPreferences */ private $userPreference; + /** @var string */ + private $userId; + /** * @param IRequest $request * @param IUserPreferences $userPreference + * @param string $UserId */ - public function __construct(IRequest $request, IUserPreferences $userPreference) { + public function __construct(IRequest $request, IUserPreferences $userPreference, string $UserId) { parent::__construct('mail', $request); $this->userPreference = $userPreference; + $this->userId = $UserId; } /** @@ -56,7 +61,7 @@ class PreferencesController extends Controller { */ public function show(string $id): JSONResponse { return new JSONResponse([ - 'value' => $this->userPreference->getPreference($id) + 'value' => $this->userPreference->getPreference($this->userId, $id) ]); } @@ -74,7 +79,8 @@ class PreferencesController extends Controller { throw new ClientException('key or value missing'); } - $newValue = $this->userPreference->setPreference($key, $value); + + $newValue = $this->userPreference->setPreference($this->userId, $key, $value); return new JSONResponse([ 'value' => $newValue, |