diff options
author | Vitor Mattos <vitor@php.rio> | 2023-05-04 12:54:09 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2023-05-05 05:18:58 -0300 |
commit | d91ce3252490d6a622ec3169d89bd178a18ab2f2 (patch) | |
tree | 95bec2b0254912648f187f928510af9592a17f36 /lib | |
parent | 6070acad9a101fda7682db970352f1d706559a51 (diff) |
Add user setting for toggle typing privacy
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 | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 8d778540d..84bd18c67 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -134,6 +134,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 +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()); } $pubKey = $this->talkConfig->getSignalingTokenPublicKey(); diff --git a/lib/Config.php b/lib/Config.php index da5148c3a..093b679c0 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -87,6 +87,14 @@ class Config { (string) Participant::PRIVACY_PUBLIC); } + public function getTypingPrivacy(string $userId): int { + return (int) $this->config->getUserValue( + $userId, + 'spreed', 'typing_privacy', + (string) Participant::PRIVACY_PUBLIC); + + } + /** * @return string[] */ |