diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-05-05 13:47:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 13:47:38 +0200 |
commit | aebe7c0215ca389cf8ead42947ca8c8526b56dd2 (patch) | |
tree | 0465872cd247fd4d440bbc2532be188b9adb6b7e /lib | |
parent | 496dd1da70d1d7f76af9896e51f48f96ba111dcf (diff) | |
parent | b8eb2658d31f75a584f4124afde798232835b997 (diff) |
Merge pull request #9455 from nextcloud/feature/user-setting-for-typing-privacy
Add user setting for toggle typing privacy
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Capabilities.php | 3 | ||||
-rw-r--r-- | lib/Config.php | 8 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 2 | ||||
-rw-r--r-- | lib/TInitialState.php | 10 |
4 files changed, 22 insertions, 1 deletions
diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 8d778540d..8692e9884 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -118,6 +118,7 @@ class Capabilities implements IPublicCapability { 'chat-get-context', 'single-conversation-status', 'chat-keep-notifications', + 'typing-privacy', ], 'config' => [ 'attachments' => [ @@ -134,6 +135,7 @@ class Capabilities implements IPublicCapability { 'read-privacy' => Participant::PRIVACY_PUBLIC, // Transform the JsonSerializable language tuples to arrays 'translations' => json_decode(json_encode($this->translationManager->getLanguages()), true), + 'typing-privacy' => Participant::PRIVACY_PUBLIC, ], 'conversations' => [ 'can-create' => $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user) @@ -159,6 +161,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->getUserTypingPrivacy($user->getUID()); } $pubKey = $this->talkConfig->getSignalingTokenPublicKey(); diff --git a/lib/Config.php b/lib/Config.php index da5148c3a..4a06bc6b0 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -87,6 +87,14 @@ class Config { (string) Participant::PRIVACY_PUBLIC); } + public function getUserTypingPrivacy(string $userId): int { + return (int) $this->config->getUserValue( + $userId, + 'spreed', 'typing_privacy', + (string) Participant::PRIVACY_PUBLIC); + + } + /** * @return string[] */ diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 2553d1e36..ac5592862 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -114,7 +114,7 @@ class SettingsController extends OCSController { return false; } - if ($setting === 'read_status_privacy') { + if ($setting === 'typing_privacy' || $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..2df881eed 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', + Participant::PRIVACY_PUBLIC + ); + + $this->initialState->provideInitialState( 'attachment_folder', '' ); |