diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-01-24 15:49:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 15:49:53 +0300 |
commit | d4707ca10208eefab54fea6858311ec4e59fc4b6 (patch) | |
tree | 4e3ae468d1dff074ddefd3a7fb8c85a41cf8ba1b | |
parent | d992ffcbec5c7b023aba5c96f4423260094c441d (diff) | |
parent | d448064bf8774d2b44c38802c1d287bc6a1382e4 (diff) |
Merge pull request #6823 from nextcloud/backport/6812/stable22
[stable22] Don't force signaling mode when HPB trial is used
-rw-r--r-- | lib/BackgroundJob/CheckHostedSignalingServer.php | 5 | ||||
-rw-r--r-- | lib/Controller/HostedSignalingServerController.php | 2 | ||||
-rw-r--r-- | tests/php/BackgroundJob/CheckHostedSignalingServerTest.php | 34 |
3 files changed, 19 insertions, 22 deletions
diff --git a/lib/BackgroundJob/CheckHostedSignalingServer.php b/lib/BackgroundJob/CheckHostedSignalingServer.php index 5f5d532cf..5b50cc758 100644 --- a/lib/BackgroundJob/CheckHostedSignalingServer.php +++ b/lib/BackgroundJob/CheckHostedSignalingServer.php @@ -93,7 +93,7 @@ class CheckHostedSignalingServer extends TimedJob { if ($oldStatus !== $newStatus) { if ($oldStatus === 'active') { // remove signaling servers if account is not active anymore - $this->config->setAppValue('spreed', 'signaling_mode', 'internal'); + $this->config->deleteAppValue('spreed', 'signaling_mode'); $this->config->deleteAppValue('spreed', 'signaling_servers'); $notificationSubject = 'removed'; @@ -101,7 +101,7 @@ class CheckHostedSignalingServer extends TimedJob { if ($newStatus === 'active') { // add signaling servers if account got active - $this->config->setAppValue('spreed', 'signaling_mode', 'external'); + $this->config->deleteAppValue('spreed', 'signaling_mode'); $this->config->setAppValue('spreed', 'signaling_servers', json_encode([ 'servers' => [ [ @@ -128,7 +128,6 @@ class CheckHostedSignalingServer extends TimedJob { $oldAccountInfo['signaling']['url'] !== $accountInfo['signaling']['url'] || $oldAccountInfo['signaling']['secret'] !== $accountInfo['signaling']['secret']) ) { - $this->config->setAppValue('spreed', 'signaling_mode', 'external'); $this->config->setAppValue('spreed', 'signaling_servers', json_encode([ 'servers' => [ [ diff --git a/lib/Controller/HostedSignalingServerController.php b/lib/Controller/HostedSignalingServerController.php index 929471626..d4b84edb2 100644 --- a/lib/Controller/HostedSignalingServerController.php +++ b/lib/Controller/HostedSignalingServerController.php @@ -121,7 +121,7 @@ class HostedSignalingServerController extends OCSController { $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account-id'); // remove signaling servers if account is not active anymore - $this->config->setAppValue('spreed', 'signaling_mode', 'internal'); + $this->config->deleteAppValue('spreed', 'signaling_mode'); $this->config->deleteAppValue('spreed', 'signaling_servers'); $this->logger->info('Deleted hosted signaling server account with ID ' . $accountId); diff --git a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php index 0627baef6..4731eed36 100644 --- a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php +++ b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php @@ -110,26 +110,24 @@ class CheckHostedSignalingServerTest extends TestCase { ], ]; - $this->config->expects($this->at(0)) - ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account-id', '') - ->willReturn('my-account-id'); - $this->config->expects($this->at(1)) + $this->config ->method('getAppValue') - ->with('spreed', 'hosted-signaling-server-account', '{}') - ->willReturn('{"status": "pending"}'); - $this->config->expects($this->at(2)) - ->method('setAppValue') - ->with('spreed', 'signaling_mode', 'external'); - $this->config->expects($this->at(3)) + ->will($this->returnValueMap([ + ['spreed', 'hosted-signaling-server-account-id', '', 'my-account-id'], + ['spreed', 'hosted-signaling-server-account', '{}', '{"status": "pending"}'] + ])); + $this->config->expects($this->once()) + ->method('deleteAppValue') + ->withConsecutive( + ['spreed', 'signaling_mode'], + ); + $this->config->expects($this->exactly(3)) ->method('setAppValue') - ->with('spreed', 'signaling_servers', '{"servers":[{"server":"signaling-url","verify":true}],"secret":"signaling-secret"}'); - $this->config->expects($this->at(4)) - ->method('setAppValue') - ->with('spreed', 'hosted-signaling-server-account', json_encode($newStatus)); - $this->config->expects($this->at(5)) - ->method('setAppValue') - ->with('spreed', 'hosted-signaling-server-account-last-checked', null); + ->withConsecutive( + ['spreed', 'signaling_servers', '{"servers":[{"server":"signaling-url","verify":true}],"secret":"signaling-secret"}'], + ['spreed', 'hosted-signaling-server-account', json_encode($newStatus)], + ['spreed', 'hosted-signaling-server-account-last-checked', null] + ); $group = $this->createMock(IGroup::class); $this->groupManager->expects($this->once()) |