diff options
author | Vitor Mattos <vitor@php.rio> | 2023-05-04 17:05:24 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2023-05-05 05:18:58 -0300 |
commit | 3c62e4a8e35a92bdd14b433193c4ca4f91a18cb6 (patch) | |
tree | 660fd312a7239aa451d90be78d96f6854aec4807 /lib | |
parent | 047ed73a4600a3628198ee7c95d99da9ba982385 (diff) |
Add unit tests and implement pending methods
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Capabilities.php | 2 | ||||
-rw-r--r-- | lib/Config.php | 2 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 4 | ||||
-rw-r--r-- | lib/TInitialState.php | 10 |
4 files changed, 16 insertions, 2 deletions
diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 84bd18c67..03ba968da 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -160,7 +160,7 @@ class Capabilities implements IPublicCapability { if ($user instanceof IUser) { $capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); $capabilities['config']['chat']['read-privacy'] = $this->talkConfig->getUserReadPrivacy($user->getUID()); - $capabilities['config']['chat']['typing-privacy'] = $this->talkConfig->getTypingPrivacy($user->getUID()); + $capabilities['config']['chat']['typing-privacy'] = $this->talkConfig->getUserTypingPrivacy($user->getUID()); } $pubKey = $this->talkConfig->getSignalingTokenPublicKey(); diff --git a/lib/Config.php b/lib/Config.php index 093b679c0..4a06bc6b0 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -87,7 +87,7 @@ class Config { (string) Participant::PRIVACY_PUBLIC); } - public function getTypingPrivacy(string $userId): int { + public function getUserTypingPrivacy(string $userId): int { return (int) $this->config->getUserValue( $userId, 'spreed', 'typing_privacy', diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 2553d1e36..8a7682e00 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -114,6 +114,10 @@ class SettingsController extends OCSController { return false; } + if ($setting === 'typing_privacy') { + return $value === '1' || $value === '0'; + } + if ($setting === 'read_status_privacy') { return (int) $value === Participant::PRIVACY_PUBLIC || (int) $value === Participant::PRIVACY_PRIVATE; diff --git a/lib/TInitialState.php b/lib/TInitialState.php index b02eeecab..cf0d6e489 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -122,6 +122,11 @@ trait TInitialState { ); $this->initialState->provideInitialState( + 'typing_privacy', + $this->talkConfig->getUserTypingPrivacy($user->getUID()) + ); + + $this->initialState->provideInitialState( 'play_sounds', $this->serverConfig->getUserValue($user->getUID(), 'spreed', 'play_sounds', 'yes') === 'yes' ); @@ -191,6 +196,11 @@ trait TInitialState { ); $this->initialState->provideInitialState( + 'typing_privacy', + '0' + ); + + $this->initialState->provideInitialState( 'attachment_folder', '' ); |