Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,30 @@
'apiVersion' => 'v1',
],
],
[
'name' => 'Settings#blockUser',
'url' => '/api/{apiVersion}/settings/block-user',
'verb' => 'POST',
'requirements' => [
'apiVersion' => 'v(4)'
]
],
[
'name' => 'Settings#unblockUser',
'url' => '/api/{apiVersion}/settings/block-user',
'verb' => 'DELETE',
'requirements' => [
'apiVersion' => 'v(4)'
]
],
[
'name' => 'Settings#listBlockedUsers',
'url' => '/api/{apiVersion}/settings/block-user',
'verb' => 'GET',
'requirements' => [
'apiVersion' => 'v(4)'
]
],

/**
* HostedSignalingServer
Expand Down
21 changes: 21 additions & 0 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,25 @@ public function setSIPSettings(

return new DataResponse();
}

/**
* @NoAdminRequired
*/
public function blockUser($type, $blocked): DataResponse {
return new DataResponse([], Http::STATUS_OK);
}

/**
* @NoAdminRequired
*/
public function unblockUser(): DataResponse {
return new DataResponse([], Http::STATUS_OK);
}

/**
* @NoAdminRequired
*/
public function listBlockedUsers(): DataResponse {
return new DataResponse([], Http::STATUS_OK);
}
}
20 changes: 20 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2126,4 +2126,24 @@ protected function getUserCookieJar($user) {
protected function assertStatusCode(ResponseInterface $response, int $statusCode, string $message = '') {
Assert::assertEquals($statusCode, $response->getStatusCode(), $message);
}

/**
* @When /^user "([^"]*)" block (user|group|email|circle) "([^"]*)" with (\d+) \((v4)\)$/
*
* @param string $user
* @param string $type
* @param string $blocked
* @param int $statusCode
* @param string $apiVersion
*/
public function userBlockUserWithV(string $user, string $type, string $blocked, int $statusCode, string $apiVersion) {
$this->setCurrentUser($user);
$this->sendRequest(
'POST', '/apps/spreed/api/' . $apiVersion . '/settings/block-user', [
'type' => $type,
'blocked' => $blocked
]
);
$this->assertStatusCode($this->response, $statusCode);
}
}
19 changes: 19 additions & 0 deletions tests/integration/features/settings/block-user.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: settings/block-user

Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists

Scenario: user 1 block user 2
When user "participant1" creates room "group room" (v4)
| roomType | 2 |
| roomName | room |
And user "participant1" adds user "participant2" to room "group room" with 200 (v4)
And user "participant1" adds user "participant3" to room "group room" with 200 (v4)
And user "participant1" gets the following candidate mentions in room "group room" for "" with 200
| id | label | source |
| all | room | calls |
| participant2 | participant2-displayname | users |
| participant3 | participant3-displayname | users |
And user "participant1" block user "participant2" with 200 (v4)