diff options
author | Joas Schilling <coding@schilljs.com> | 2020-05-14 12:27:17 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-05-14 13:27:28 +0300 |
commit | 923a49268e3cf42528a85edaf4554216fd039c27 (patch) | |
tree | fb17e6df7a136e29497d5a728dc65952b13f37ba /lib/Capabilities.php | |
parent | 05881c5ab224f4c451fb44b786b7bc216ce2c508 (diff) |
Only send the capability when the config is set
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Capabilities.php')
-rw-r--r-- | lib/Capabilities.php | 92 |
1 files changed, 45 insertions, 47 deletions
diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 5e2f15f6d..3a31ad556 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -54,59 +54,57 @@ class Capabilities implements IPublicCapability { return []; } - $maxChatLength = 1000; - if (version_compare($this->serverConfig->getSystemValueString('version', '0.0.0'), '16.0.2', '>=')) { - $maxChatLength = ChatManager::MAX_CHAT_LENGTH; - } - - $attachments = [ - 'allowed' => $user instanceof IUser, + $capabilities = [ + 'features' => [ + 'audio', + 'video', + 'chat-v2', + 'conversation-v2', + 'guest-signaling', + 'empty-group-room', + 'guest-display-names', + 'multi-room-users', + 'favorites', + 'last-room-activity', + 'no-ping', + 'system-messages', + 'mention-flag', + 'in-call-flags', + 'notification-levels', + 'invite-groups-and-mails', + 'locked-one-to-one-rooms', + 'read-only-rooms', + 'chat-read-marker', + 'webinary-lobby', + 'start-call-flag', + 'chat-replies', + 'circles-support', + 'force-mute', + ], + 'config' => [ + 'attachments' => [ + 'allowed' => $user instanceof IUser, + ], + 'chat' => [ + 'max-length' => ChatManager::MAX_CHAT_LENGTH, + ], + 'conversations' => [], + ], ]; + if ($user instanceof IUser) { - $attachments['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); + $capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); } - $conversations = [ - 'can-create' => $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user), - ]; + $capabilities['config']['conversations']['can-create'] = $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user); + + + if ($this->serverConfig->getAppValue('spreed', 'has_reference_id', 'no') === 'yes') { + $capabilities['features'][] = 'chat-reference-id'; + } return [ - 'spreed' => [ - 'features' => [ - 'audio', - 'video', - 'chat-v2', - 'conversation-v2', - 'guest-signaling', - 'empty-group-room', - 'guest-display-names', - 'multi-room-users', - 'favorites', - 'last-room-activity', - 'no-ping', - 'system-messages', - 'mention-flag', - 'in-call-flags', - 'notification-levels', - 'invite-groups-and-mails', - 'locked-one-to-one-rooms', - 'read-only-rooms', - 'chat-read-marker', - 'webinary-lobby', - 'start-call-flag', - 'chat-replies', - 'circles-support', - 'force-mute', - 'chat-reference-id', - ], - 'config' => [ - 'attachments' => $attachments, - 'chat' => [ - 'max-length' => $maxChatLength, - ], - 'conversations' => $conversations, - ], - ], + 'spreed' => $capabilities, ]; } } |