Skip to content

Commit a2a9764

Browse files
committed
Change var name from permission to config
Signed-off-by: Vitor Mattos <[email protected]>
1 parent abc6419 commit a2a9764

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

docs/conversation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,14 @@ Get all (for moderators and in case of "free selection") or the assigned breakou
433433
* Endpoint: `/room/{token}/can-mention-everyone`
434434
* Data:
435435

436-
| field | type | Description |
437-
|--------------|------|---------------------------------------------------------------------------|
438-
| `permission` | int | See [Constants - Can mention everyone](constants.md#can-mention-everyone) |
436+
| field | type | Description |
437+
|----------|------|---------------------------------------------------------------------------|
438+
| `config` | int | See [Constants - Can mention everyone](constants.md#can-mention-everyone) |
439439

440440
* Response:
441441
- Status code:
442442
+ `200 OK`
443-
+ `400 Bad Request` Error: `config`: When is an invalid constant to handle the permission
443+
+ `400 Bad Request` Error: `config`: When the provided config value is invalid
444444
+ `400 Bad Request` Error: `room`: When the conversation is a one-to-one conversation
445445
+ `403 Forbidden` When the current user is not a moderator/owner or the conversation is not a one-to-one conversation
446446
+ `404 Not Found` When the conversation could not be found for the participant

lib/Controller/RoomController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,9 +1494,9 @@ public function setMessageExpiration(int $seconds): DataResponse {
14941494

14951495
#[NoAdminRequired]
14961496
#[RequireLoggedInModeratorParticipant]
1497-
public function setCanMentionEveryone(int $permission = Room::CAN_MENTION_EVERYONE_ALL): DataResponse {
1497+
public function setCanMentionEveryone(int $config = Room::CAN_MENTION_EVERYONE_ALL): DataResponse {
14981498
try {
1499-
$this->roomService->setCanMentionEveryone($this->room, $permission);
1499+
$this->roomService->setCanMentionEveryone($this->room, $config);
15001500
} catch (\InvalidArgumentException $e) {
15011501
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
15021502
}

lib/Service/RoomService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,12 @@ public function deleteRoom(Room $room): void {
852852
}
853853
}
854854

855-
public function setCanMentionEveryone(Room $room, int $permission): void {
855+
public function setCanMentionEveryone(Room $room, int $config): void {
856856
$allowedValues = [
857857
Room::CAN_MENTION_EVERYONE_MODERATORS,
858858
Room::CAN_MENTION_EVERYONE_ALL
859859
];
860-
if (!in_array($permission, $allowedValues)) {
860+
if (!in_array($config, $allowedValues)) {
861861
throw new InvalidArgumentException('config');
862862
}
863863
if ($room->getType() !== Room::TYPE_GROUP
@@ -867,20 +867,20 @@ public function setCanMentionEveryone(Room $room, int $permission): void {
867867
}
868868

869869
$old = $room->getCanMentionEveryone();
870-
if ($old === $permission) {
870+
if ($old === $config) {
871871
return;
872872
}
873873

874-
$event = new ModifyRoomEvent($room, 'canMentionEveryone', $permission, $old);
874+
$event = new ModifyRoomEvent($room, 'canMentionEveryone', $config, $old);
875875
$this->dispatcher->dispatch(Room::EVENT_BEFORE_SET_CAN_MENTION_EVERYONE, $event);
876876

877877
$update = $this->db->getQueryBuilder();
878878
$update->update('talk_rooms')
879-
->set('can_mention_everyone', $update->createNamedParameter($permission, IQueryBuilder::PARAM_INT))
879+
->set('can_mention_everyone', $update->createNamedParameter($config, IQueryBuilder::PARAM_INT))
880880
->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)));
881881
$update->executeStatement();
882882

883-
$room->setCanMentionEveryone($permission);
883+
$room->setCanMentionEveryone($config);
884884

885885
$this->dispatcher->dispatch(Room::EVENT_AFTER_SET_CAN_MENTION_EVERYONE, $event);
886886
}

tests/integration/features/bootstrap/FeatureContext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,13 +3159,13 @@ public function userSetTheMessageExpirationToXWithStatusCode(string $user, int $
31593159
*/
31603160
public function userSetMentionEveryoneOfRoomWithStatus(string $user, string $who, string $identifier, int $statusCode, string $apiVersion = 'v1'): void {
31613161
if ($who === 'all') {
3162-
$permission = 1;
3162+
$config = 1;
31633163
} elseif ($who === 'moderators') {
3164-
$permission = 0;
3164+
$config = 0;
31653165
}
31663166
$this->setCurrentUser($user);
31673167
$this->sendRequest('PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/can-mention-everyone', [
3168-
'permission' => $permission,
3168+
'config' => $config,
31693169
]);
31703170
$this->assertStatusCode($this->response, $statusCode);
31713171
}

0 commit comments

Comments
 (0)