mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Merge pull request #13491 from nextcloud/feat/13463/force-end-call
Force call ends after X - API Follow ups
This commit is contained in:
commit
c5ea96e7d4
25 changed files with 159 additions and 18 deletions
|
|
@ -160,3 +160,4 @@
|
|||
* `archived-conversations` (local) - Conversations can be marked as archived which will hide them from the conversation list by default
|
||||
* `talk-polls-drafts` - Whether moderators can store and retrieve poll drafts
|
||||
* `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.
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ use OCA\Talk\Search\UnifiedSearchFilterPlugin;
|
|||
use OCA\Talk\Settings\BeforePreferenceSetEventListener;
|
||||
use OCA\Talk\Settings\Personal;
|
||||
use OCA\Talk\SetupCheck\BackgroundBlurLoading;
|
||||
use OCA\Talk\SetupCheck\Configuration;
|
||||
use OCA\Talk\SetupCheck\FederationLockCache;
|
||||
use OCA\Talk\SetupCheck\HighPerformanceBackend;
|
||||
use OCA\Talk\SetupCheck\RecordingBackend;
|
||||
|
|
@ -341,6 +342,7 @@ class Application extends App implements IBootstrap {
|
|||
|
||||
$context->registerTeamResourceProvider(TalkTeamResourceProvider::class);
|
||||
|
||||
$context->registerSetupCheck(Configuration::class);
|
||||
$context->registerSetupCheck(HighPerformanceBackend::class);
|
||||
$context->registerSetupCheck(FederationLockCache::class);
|
||||
$context->registerSetupCheck(RecordingBackend::class);
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ class Capabilities implements IPublicCapability {
|
|||
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
|
||||
'can-enable-sip' => false,
|
||||
'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()),
|
||||
'max-duration' => $this->appConfig->getAppValueInt('max_call_duration'),
|
||||
],
|
||||
'chat' => [
|
||||
'max-length' => ChatManager::MAX_CHAT_LENGTH,
|
||||
|
|
|
|||
|
|
@ -1112,7 +1112,13 @@ class SystemMessage implements IEventListener {
|
|||
|
||||
switch ($numUsers) {
|
||||
case 0:
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->n(
|
||||
'Call with %n guest was ended, as it reached the maximum call duration (Duration {duration})',
|
||||
'Call with %n guests was ended, as it reached the maximum call duration (Duration {duration})',
|
||||
$parameters['guests']
|
||||
);
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->n(
|
||||
'Call with %n guest ended (Duration {duration})',
|
||||
'Call with %n guests ended (Duration {duration})',
|
||||
|
|
@ -1127,7 +1133,9 @@ class SystemMessage implements IEventListener {
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1} and {user2} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1} and {user2} ended (Duration {duration})');
|
||||
} else {
|
||||
if ($parameters['guests'] === 0) {
|
||||
|
|
@ -1140,13 +1148,17 @@ class SystemMessage implements IEventListener {
|
|||
break;
|
||||
case 2:
|
||||
if ($parameters['guests'] === 0) {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1} and {user2} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1} and {user2} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1} and {user2} (Duration {duration})');
|
||||
}
|
||||
} else {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2} and {user3} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2} and {user3} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2} and {user3} (Duration {duration})');
|
||||
|
|
@ -1156,13 +1168,17 @@ class SystemMessage implements IEventListener {
|
|||
break;
|
||||
case 3:
|
||||
if ($parameters['guests'] === 0) {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2} and {user3} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2} and {user3} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2} and {user3} (Duration {duration})');
|
||||
}
|
||||
} else {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3} and {user4} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3} and {user4} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2}, {user3} and {user4} (Duration {duration})');
|
||||
|
|
@ -1172,13 +1188,17 @@ class SystemMessage implements IEventListener {
|
|||
break;
|
||||
case 4:
|
||||
if ($parameters['guests'] === 0) {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3} and {user4} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3} and {user4} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2}, {user3} and {user4} (Duration {duration})');
|
||||
}
|
||||
} else {
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3}, {user4} and {user5} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3}, {user4} and {user5} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration {duration})');
|
||||
|
|
@ -1188,7 +1208,9 @@ class SystemMessage implements IEventListener {
|
|||
break;
|
||||
case 5:
|
||||
default:
|
||||
if ($message === 'call_ended' || $actorIsSystem) {
|
||||
if ($actorIsSystem) {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3}, {user4} and {user5} was ended, as it reached the maximum call duration (Duration {duration})');
|
||||
} elseif ($message === 'call_ended') {
|
||||
$subject = $this->l->t('Call with {user1}, {user2}, {user3}, {user4} and {user5} ended (Duration {duration})');
|
||||
} else {
|
||||
$subject = $this->l->t('{actor} ended the call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration {duration})');
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ namespace OCA\Talk;
|
|||
* sip-dialout-enabled: bool,
|
||||
* can-enable-sip: bool,
|
||||
* start-without-media: bool,
|
||||
* max-duration: int,
|
||||
* },
|
||||
* chat: array{
|
||||
* max-length: int,
|
||||
|
|
|
|||
55
lib/SetupCheck/Configuration.php
Normal file
55
lib/SetupCheck/Configuration.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
namespace OCA\Talk\SetupCheck;
|
||||
|
||||
use OCP\AppFramework\Services\IAppConfig;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
/**
|
||||
* Check app configs and their dependencies
|
||||
*/
|
||||
class Configuration implements ISetupCheck {
|
||||
public function __construct(
|
||||
protected IL10N $l10n,
|
||||
protected IConfig $config,
|
||||
protected IAppConfig $appConfig,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Talk configuration');
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
$errors = $warnings = [];
|
||||
$maxCallDuration = $this->appConfig->getAppValueInt('max_call_duration');
|
||||
if ($maxCallDuration > 0) {
|
||||
if ($this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax') !== 'cron') {
|
||||
$errors[] = $this->l10n->t('Forcing a call duration is only supported with system cron. Please enable system cron or remove the `max_call_duration` configuration.');
|
||||
} elseif ($maxCallDuration < 3600) {
|
||||
$warnings[] = $this->l10n->t('Small `max_call_duration` values (currently set to %d) are not enforceable due to technical limitations. The background job is only executed every 5 minutes, so use at own risk.', [$maxCallDuration]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($errors)) {
|
||||
return SetupResult::error(implode("\n", $errors));
|
||||
}
|
||||
if (!empty($warnings)) {
|
||||
return SetupResult::warning(implode("\n", $warnings));
|
||||
}
|
||||
return SetupResult::success();
|
||||
}
|
||||
}
|
||||
|
|
@ -148,7 +148,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -190,6 +191,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -123,6 +124,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -123,6 +124,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -166,6 +167,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -123,6 +124,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -166,6 +167,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -300,7 +300,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -342,6 +343,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -241,7 +241,8 @@
|
|||
"sip-enabled",
|
||||
"sip-dialout-enabled",
|
||||
"can-enable-sip",
|
||||
"start-without-media"
|
||||
"start-without-media",
|
||||
"max-duration"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
|
@ -283,6 +284,10 @@
|
|||
},
|
||||
"start-without-media": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"max-duration": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ export const mockedCapabilities: Capabilities = {
|
|||
'sip-dialout-enabled': true,
|
||||
'can-enable-sip': true,
|
||||
'start-without-media': false,
|
||||
'max-duration': 0,
|
||||
},
|
||||
chat: {
|
||||
'max-length': 32000,
|
||||
|
|
|
|||
|
|
@ -229,6 +229,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -144,6 +144,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -1905,6 +1905,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -1402,6 +1402,8 @@ export type components = {
|
|||
"sip-dialout-enabled": boolean;
|
||||
"can-enable-sip": boolean;
|
||||
"start-without-media": boolean;
|
||||
/** Format: int64 */
|
||||
"max-duration": number;
|
||||
};
|
||||
chat: {
|
||||
/** Format: int64 */
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ class CapabilitiesTest extends TestCase {
|
|||
'sip-dialout-enabled' => false,
|
||||
'can-enable-sip' => false,
|
||||
'start-without-media' => false,
|
||||
'max-duration' => 0,
|
||||
'predefined-backgrounds' => [
|
||||
'1_office.jpg',
|
||||
'2_home.jpg',
|
||||
|
|
@ -254,6 +255,7 @@ class CapabilitiesTest extends TestCase {
|
|||
'sip-dialout-enabled' => false,
|
||||
'can-enable-sip' => false,
|
||||
'start-without-media' => false,
|
||||
'max-duration' => 0,
|
||||
'predefined-backgrounds' => [
|
||||
'1_office.jpg',
|
||||
'2_home.jpg',
|
||||
|
|
|
|||
|
|
@ -1534,7 +1534,7 @@ class SystemMessageTest extends TestCase {
|
|||
['users' => ['user1', 'user2', 'user3', 'user4'], 'guests' => 4, 'duration' => 42],
|
||||
['type' => 'guest', 'id' => 'guest/system', 'name' => 'system'],
|
||||
[
|
||||
'Call with {user1}, {user2}, {user3}, {user4} and 4 guests ended (Duration "duration")',
|
||||
'Call with {user1}, {user2}, {user3}, {user4} and 4 guests was ended, as it reached the maximum call duration (Duration "duration")',
|
||||
['user1' => ['data' => 'user1'], 'user2' => ['data' => 'user2'], 'user3' => ['data' => 'user3'], 'user4' => ['data' => 'user4']],
|
||||
],
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue