fix(ban): Remove unused methods

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2024-07-10 12:39:14 +02:00
parent 9eb9aa2caa
commit 2a9f0c0db1
No known key found for this signature in database
GPG key ID: 74434EFE0D2E2205
3 changed files with 0 additions and 45 deletions

View file

@ -111,19 +111,4 @@ class BanController extends AEnvironmentAwareController {
$this->banService->findAndDeleteBanByIdForRoom($banId, $this->room->getId());
return new DataResponse([], Http::STATUS_OK);
}
/**
* @psalm-return TalkBan
*/
protected function randomBan(string $actorType, string $actorId): array {
return [
'id' => random_int(1, 1337),
'actorType' => $this->participant->getAttendee()->getActorType(),
'actorId' => $this->participant->getAttendee()->getActorId(),
'bannedType' => $actorType,
'bannedId' => $actorId,
'bannedTime' => random_int(1514747958, 1714747958),
'internalNote' => '#NOTE#' . $actorType . '#' . $actorId . '#' . sha1($actorType . $actorId),
];
}
}

View file

@ -61,15 +61,4 @@ class BanMapper extends QBMapper {
return $this->findEntity($query);
}
public function deleteBanForActorAndRoom(string $actorId, string $actorType, int $roomId): void {
$query = $this->db->getQueryBuilder();
$query->delete($this->getTableName())
->where($query->expr()->eq('actor_id', $query->createNamedParameter($actorId, IQueryBuilder::PARAM_STR)))
->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter($actorType, IQueryBuilder::PARAM_STR)))
->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT)));
$query->executeStatement();
}
}

View file

@ -53,25 +53,6 @@ class BanService {
return $this->banMapper->findForActorAndRoom($actorId, $actorType, $roomId);
}
/**
* Delete a ban for a specific actor and room.
*/
public function deleteBanForActorAndRoom(string $actorId, string $actorType, int $roomId): void {
$this->banMapper->deleteBanForActorAndRoom($actorId, $actorType, $roomId);
}
/**
* Find and delete a ban for a specific actor and room.
*/
public function findAndDeleteBanForActorAndRoom(string $actorId, string $actorType, int $roomId): void {
try {
$ban = $this->getBanForActorAndRoom($actorId, $actorType, $roomId);
$this->deleteBanForActorAndRoom($actorId, $actorType, $roomId);
} catch (DoesNotExistException $e) {
// Ban does not exist
}
}
/**
* Retrieve all bans for a specific room.
*/