Skip to content

Commit a60dc83

Browse files
Merge pull request #15515 from nextcloud/backport/15511/stable30
[stable30] test(federation): Add a test to change call notification settings in …
2 parents 379d4c2 + c3cf9e8 commit a60dc83

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

lib/Controller/RoomController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ public function setNotificationLevel(int $level): DataResponse {
796796
* 200: Call notification level updated successfully
797797
* 400: Updating call notification level is not possible
798798
*/
799+
#[FederationSupported]
799800
#[NoAdminRequired]
800801
#[RequireLoggedInParticipant]
801802
public function setNotificationCalls(int $level): DataResponse {

tests/integration/features/bootstrap/FeatureContext.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,32 @@ public function userSetsNotificationLevelForRoom(string $user, string $level, st
15171517
$this->assertStatusCode($this->response, 200);
15181518
}
15191519

1520+
/**
1521+
* @Then /^user "([^"]*)" sets call notifications to (enabled|disabled) for room "([^"]*)" \((v4)\)$/
1522+
*
1523+
* @param string $user
1524+
* @param string $level
1525+
* @param string $identifier
1526+
* @param string $apiVersion
1527+
*/
1528+
public function userSetsCallNotificationLevelForRoom(string $user, string $level, string $identifier, string $apiVersion): void {
1529+
$this->setCurrentUser($user);
1530+
1531+
$intLevel = 1; // default
1532+
if ($level === 'disabled') {
1533+
$intLevel = 0;
1534+
}
1535+
1536+
$this->sendRequest(
1537+
'POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/notify-calls',
1538+
new TableNode([
1539+
['level', $intLevel],
1540+
])
1541+
);
1542+
1543+
$this->assertStatusCode($this->response, 200);
1544+
}
1545+
15201546
/**
15211547
* @Then /^user "([^"]*)" leaves room "([^"]*)" with (\d+) \((v4)\)$/
15221548
*

tests/integration/features/federation/call.feature

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,26 @@ Feature: federation/call
317317
And user "participant1" has the following notifications
318318
| app | object_type | object_id | subject |
319319

320+
Scenario: Turning off call notifications also works
321+
Given user "participant1" creates room "room" (v4)
322+
| roomType | 2 |
323+
| roomName | room |
324+
And user "participant1" adds federated_user "participant2@REMOTE" to room "room" with 200 (v4)
325+
And using server "REMOTE"
326+
And user "participant2" has the following invitations (v1)
327+
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
328+
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
329+
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
330+
| id | name | type | remoteServer | remoteToken |
331+
| LOCAL::room | room | 2 | LOCAL | room |
332+
And user "participant2" sets call notifications to disabled for room "LOCAL::room" (v4)
333+
And using server "LOCAL"
334+
And user "participant1" joins room "room" with 200 (v4)
335+
When user "participant1" joins call "room" with 200 (v4)
336+
And using server "REMOTE"
337+
And user "participant2" has the following notifications
338+
| app | object_type | object_id | subject |
339+
320340
Scenario: missed silent call by federated user does not trigger call notification
321341
Given user "participant1" creates room "room" (v4)
322342
| roomType | 2 |

0 commit comments

Comments
 (0)