Skip to content

Commit

Permalink
feat(chat): Expose summary-threshold in capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Nov 14, 2024
1 parent b9f206c commit fb841e8
Show file tree
Hide file tree
Showing 21 changed files with 80 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class Capabilities implements IPublicCapability {
'read-privacy',
'has-translation-providers',
'typing-privacy',
'summary-threshold',
],
'conversations' => [
'can-create',
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@
* read-privacy: int,
* has-translation-providers: bool,
* typing-privacy: int,
* summary-threshold: positive-int,
* },
* conversations: array{
* can-create: bool,
Expand Down
8 changes: 7 additions & 1 deletion openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -221,6 +222,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-backend-recording.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -154,6 +155,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-backend-signaling.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -154,6 +155,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-backend-sipbridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -197,6 +198,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-bots.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -154,6 +155,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-federation.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -197,6 +198,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -373,6 +374,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@
"max-length",
"read-privacy",
"has-translation-providers",
"typing-privacy"
"typing-privacy",
"summary-threshold"
],
"properties": {
"max-length": {
Expand All @@ -314,6 +315,11 @@
"typing-privacy": {
"type": "integer",
"format": "int64"
},
"summary-threshold": {
"type": "integer",
"format": "int64",
"minimum": 1
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions src/__mocks__/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const mockedCapabilities: Capabilities = {
'read-privacy': 0,
'has-translation-providers': true,
'typing-privacy': 0,
'summary-threshold': 100,
},
conversations: {
'can-create': true,
Expand Down Expand Up @@ -156,6 +157,7 @@ export const mockedCapabilities: Capabilities = {
'read-privacy',
'has-translation-providers',
'typing-privacy',
'summary-threshold',
],
conversations: [
'can-create',
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-administration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-signaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-sipbridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-bots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/php/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fb841e8

Please sign in to comment.