Browse Source
Add capability to toggle recording
Signed-off-by: Vitor Mattos <vitor@php.rio>
pull/8445/head
Vitor Mattos
3 years ago
No known key found for this signature in database
GPG Key ID: B7AB4B76A7CA7318
4 changed files with
40 additions and
0 deletions
-
docs/capabilities.md
-
lib/Capabilities.php
-
lib/Config.php
-
tests/php/CapabilitiesTest.php
|
|
|
@ -110,3 +110,4 @@ title: Capabilities |
|
|
|
* `breakout-rooms-v1` - Whether breakout-rooms API v1 is available |
|
|
|
* `config => call => breakout-rooms` - Whether breakout rooms are enabled on this instance |
|
|
|
* `avatar` - Avatar of conversation |
|
|
|
* `recording-v1` - Call recording. Only available if app setting `call_recording` is equal to `yes`. |
|
|
|
@ -146,6 +146,10 @@ class Capabilities implements IPublicCapability { |
|
|
|
$capabilities['features'][] = 'reactions'; |
|
|
|
} |
|
|
|
|
|
|
|
if ($this->talkConfig->isBreakoutRoomsEnabled()) { |
|
|
|
$capabilities['features'][] = 'recording-v1'; |
|
|
|
} |
|
|
|
|
|
|
|
if ($user instanceof IUser) { |
|
|
|
$capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); |
|
|
|
$capabilities['config']['chat']['read-privacy'] = $this->talkConfig->getUserReadPrivacy($user->getUID()); |
|
|
|
|
|
|
|
@ -136,6 +136,10 @@ class Config { |
|
|
|
return $this->canEnableSIP[$user->getUID()]; |
|
|
|
} |
|
|
|
|
|
|
|
public function isBreakoutRoomsEnabled(): bool { |
|
|
|
return $this->config->getAppValue('spreed', 'call_recording', 'yes') === 'yes'; |
|
|
|
} |
|
|
|
|
|
|
|
public function isDisabledForUser(IUser $user): bool { |
|
|
|
$allowedGroups = $this->getAllowedTalkGroupIds(); |
|
|
|
if (empty($allowedGroups)) { |
|
|
|
|
|
|
|
@ -344,4 +344,35 @@ class CapabilitiesTest extends TestCase { |
|
|
|
$data = $capabilities->getCapabilities(); |
|
|
|
$this->assertEquals('this-is-the-key', $data['spreed']['config']['signaling']['hello-v2-token-key']); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @dataProvider dataTestCapabilityRecording |
|
|
|
*/ |
|
|
|
public function testCapabilityRecording($enabled, $expected): void { |
|
|
|
$capabilities = new Capabilities( |
|
|
|
$this->serverConfig, |
|
|
|
$this->talkConfig, |
|
|
|
$this->commentsManager, |
|
|
|
$this->userSession, |
|
|
|
$this->appManager |
|
|
|
); |
|
|
|
|
|
|
|
$this->talkConfig->expects($this->once()) |
|
|
|
->method('isBreakoutRoomsEnabled') |
|
|
|
->willReturn($enabled === 'yes'); |
|
|
|
|
|
|
|
$data = $capabilities->getCapabilities(); |
|
|
|
if ($expected === true) { |
|
|
|
$this->assertContains('recording-v1', $data['spreed']['features']); |
|
|
|
} else { |
|
|
|
$this->assertNotContains('recording-v1', $data['spreed']['features']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function dataTestCapabilityRecording(): array { |
|
|
|
return [ |
|
|
|
['yes', true], |
|
|
|
['no', false], |
|
|
|
]; |
|
|
|
} |
|
|
|
} |