From 28c669cf2e74e6857bfcf539d7c14d3a8ee0ef87 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 14 Nov 2024 15:50:40 +0100 Subject: [PATCH] feat(chat): Expose summary-threshold in capabilities Signed-off-by: Joas Schilling --- docs/capabilities.md | 1 + lib/Capabilities.php | 2 ++ lib/ResponseDefinitions.php | 1 + openapi-administration.json | 8 +++++++- openapi-backend-recording.json | 8 +++++++- openapi-backend-signaling.json | 8 +++++++- openapi-backend-sipbridge.json | 8 +++++++- openapi-bots.json | 8 +++++++- openapi-federation.json | 8 +++++++- openapi-full.json | 8 +++++++- openapi.json | 8 +++++++- src/types/openapi/openapi-administration.ts | 2 ++ src/types/openapi/openapi-backend-recording.ts | 2 ++ src/types/openapi/openapi-backend-signaling.ts | 2 ++ src/types/openapi/openapi-backend-sipbridge.ts | 2 ++ src/types/openapi/openapi-bots.ts | 2 ++ src/types/openapi/openapi-federation.ts | 2 ++ src/types/openapi/openapi-full.ts | 2 ++ src/types/openapi/openapi.ts | 2 ++ tests/php/CapabilitiesTest.php | 2 ++ 20 files changed, 78 insertions(+), 8 deletions(-) diff --git a/docs/capabilities.md b/docs/capabilities.md index e9590648870b..460638a69253 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -161,5 +161,6 @@ * `talk-polls-drafts` - Whether moderators can store and retrieve poll drafts * `download-call-participants` - Whether the endpoints for moderators to download the call participants is available * `chat-summary-api` (local) - Whether the endpoint to get summarized chat messages in a conversation is available +* `config => chat => summary-threshold` (local) - Number of unread messages that should exist to show a "Generate summary" option * `config => call => start-without-media` (local) - Boolean, whether media should be disabled when starting or joining a conversation * `config => call => max-duration` - Integer, maximum call duration in seconds. Please note that this should only be used with system cron and with a reasonable high value, due to the expended duration until the background job ran. diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 8f71b4054948..e2c03f54da11 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -144,6 +144,7 @@ class Capabilities implements IPublicCapability { 'read-privacy', 'has-translation-providers', 'typing-privacy', + 'summary-threshold', ], 'conversations' => [ 'can-create', @@ -217,6 +218,7 @@ public function getCapabilities(): array { 'read-privacy' => Participant::PRIVACY_PUBLIC, 'has-translation-providers' => $this->translationManager->hasProviders(), 'typing-privacy' => Participant::PRIVACY_PUBLIC, + 'summary-threshold' => 100, ], 'conversations' => [ 'can-create' => $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user) diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 9722340e49d5..5098e9f7e7a3 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -354,6 +354,7 @@ * read-privacy: int, * has-translation-providers: bool, * typing-privacy: int, + * summary-threshold: positive-int, * }, * conversations: array{ * can-create: bool, diff --git a/openapi-administration.json b/openapi-administration.json index fa4e80bed788..44a2bb76f6d8 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -204,7 +204,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -221,6 +222,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-backend-recording.json b/openapi-backend-recording.json index f6b1d452627e..36b875bad9bb 100644 --- a/openapi-backend-recording.json +++ b/openapi-backend-recording.json @@ -137,7 +137,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -154,6 +155,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-backend-signaling.json b/openapi-backend-signaling.json index ad42624f2900..b2676e0453ad 100644 --- a/openapi-backend-signaling.json +++ b/openapi-backend-signaling.json @@ -137,7 +137,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -154,6 +155,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-backend-sipbridge.json b/openapi-backend-sipbridge.json index 5df0b9eeb46f..ff867c2ab9da 100644 --- a/openapi-backend-sipbridge.json +++ b/openapi-backend-sipbridge.json @@ -180,7 +180,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -197,6 +198,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-bots.json b/openapi-bots.json index 8f24560fe4b6..a8a7508b63be 100644 --- a/openapi-bots.json +++ b/openapi-bots.json @@ -137,7 +137,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -154,6 +155,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-federation.json b/openapi-federation.json index 1b2274d22c79..51084c5d88c9 100644 --- a/openapi-federation.json +++ b/openapi-federation.json @@ -180,7 +180,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -197,6 +198,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi-full.json b/openapi-full.json index 77ad9ea2beb7..a76645bc5e4d 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -356,7 +356,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -373,6 +374,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/openapi.json b/openapi.json index e3f917624e6b..d18454c52be4 100644 --- a/openapi.json +++ b/openapi.json @@ -297,7 +297,8 @@ "max-length", "read-privacy", "has-translation-providers", - "typing-privacy" + "typing-privacy", + "summary-threshold" ], "properties": { "max-length": { @@ -314,6 +315,11 @@ "typing-privacy": { "type": "integer", "format": "int64" + }, + "summary-threshold": { + "type": "integer", + "format": "int64", + "minimum": 1 } } }, diff --git a/src/types/openapi/openapi-administration.ts b/src/types/openapi/openapi-administration.ts index e960be1a0785..fd9d4c7af155 100644 --- a/src/types/openapi/openapi-administration.ts +++ b/src/types/openapi/openapi-administration.ts @@ -240,6 +240,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-backend-recording.ts b/src/types/openapi/openapi-backend-recording.ts index 63f3a3b86021..48a578331d9c 100644 --- a/src/types/openapi/openapi-backend-recording.ts +++ b/src/types/openapi/openapi-backend-recording.ts @@ -74,6 +74,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-backend-signaling.ts b/src/types/openapi/openapi-backend-signaling.ts index 54bf7d5d98bf..d5381da24e94 100644 --- a/src/types/openapi/openapi-backend-signaling.ts +++ b/src/types/openapi/openapi-backend-signaling.ts @@ -60,6 +60,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-backend-sipbridge.ts b/src/types/openapi/openapi-backend-sipbridge.ts index 84e84856e367..c4a985245e28 100644 --- a/src/types/openapi/openapi-backend-sipbridge.ts +++ b/src/types/openapi/openapi-backend-sipbridge.ts @@ -155,6 +155,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-bots.ts b/src/types/openapi/openapi-bots.ts index 5e29b8e77958..6954a8e9e3b4 100644 --- a/src/types/openapi/openapi-bots.ts +++ b/src/types/openapi/openapi-bots.ts @@ -78,6 +78,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-federation.ts b/src/types/openapi/openapi-federation.ts index b498f99f0f71..5f91c1ddc2aa 100644 --- a/src/types/openapi/openapi-federation.ts +++ b/src/types/openapi/openapi-federation.ts @@ -186,6 +186,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 2a0f4d17e8ba..e04315e001ff 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -1956,6 +1956,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 2f6789216840..5b6490354459 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -1453,6 +1453,8 @@ export type components = { "has-translation-providers": boolean; /** Format: int64 */ "typing-privacy": number; + /** Format: int64 */ + "summary-threshold": number; }; conversations: { "can-create": boolean; diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index 4a8e758cc0e2..05c7aead51a0 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -147,6 +147,7 @@ public function testGetCapabilitiesGuest(): void { 'read-privacy' => 0, 'has-translation-providers' => false, 'typing-privacy' => 0, + 'summary-threshold' => 100, ], 'conversations' => [ 'can-create' => false, @@ -277,6 +278,7 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea 'read-privacy' => $readPrivacy, 'has-translation-providers' => false, 'typing-privacy' => 0, + 'summary-threshold' => 100, ], 'conversations' => [ 'can-create' => $canCreate,