diff options
author | Joas Schilling <coding@schilljs.com> | 2020-12-04 13:58:40 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-12-10 13:47:04 +0300 |
commit | 11e8e28b87467954546ed5c5acf7ad78b38ec8f3 (patch) | |
tree | 66c29de975c913aa8e25f9b86f4fa347e24b7d7c /lib | |
parent | 4ebae32362d081c144717c58d4549e22aabb683e (diff) |
Interact with integers so we can match it better in queries
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/SettingsController.php | 10 | ||||
-rw-r--r-- | lib/Participant.php | 4 | ||||
-rw-r--r-- | lib/TInitialState.php | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index db6b27e90..65907254a 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -72,10 +72,10 @@ class SettingsController extends OCSController { * @NoAdminRequired * * @param string $key - * @param string|null $value + * @param string|int|null $value * @return DataResponse */ - public function setUserSetting(string $key, ?string $value): DataResponse { + public function setUserSetting(string $key, $value): DataResponse { if (!$this->validateUserSetting($key, $value)) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -85,7 +85,7 @@ class SettingsController extends OCSController { return new DataResponse(); } - protected function validateUserSetting(string $setting, ?string $value): bool { + protected function validateUserSetting(string $setting, $value): bool { if ($setting === 'attachment_folder') { $userFolder = $this->rootFolder->getUserFolder($this->userId); try { @@ -105,8 +105,8 @@ class SettingsController extends OCSController { } if ($setting === 'read_status_privacy') { - return $value === Participant::PRIVACY_PUBLIC || - $value === Participant::PRIVACY_PRIVATE; + return (int) $value === Participant::PRIVACY_PUBLIC || + (int) $value === Participant::PRIVACY_PRIVATE; } return false; diff --git a/lib/Participant.php b/lib/Participant.php index 3c2dfc149..07e11ea0f 100644 --- a/lib/Participant.php +++ b/lib/Participant.php @@ -48,8 +48,8 @@ class Participant { public const NOTIFY_MENTION = 2; public const NOTIFY_NEVER = 3; - public const PRIVACY_PRIVATE = 'private'; - public const PRIVACY_PUBLIC = 'public'; + public const PRIVACY_PUBLIC = 0; + public const PRIVACY_PRIVATE = 1; /** @var Room */ protected $room; diff --git a/lib/TInitialState.php b/lib/TInitialState.php index 583f821f6..272d841b0 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -89,7 +89,7 @@ trait TInitialState { $this->initialStateService->provideInitialState( 'talk', 'read_status_privacy', - $this->serverConfig->getUserValue($user->getUID(), 'spreed', 'read_status_privacy', Participant::PRIVACY_PUBLIC) + (int) $this->serverConfig->getUserValue($user->getUID(), 'spreed', 'read_status_privacy', (string) Participant::PRIVACY_PUBLIC) ); $attachmentFolder = $this->talkConfig->getAttachmentFolder($user->getUID()); |