Skip to content

Commit

Permalink
Do not filter displayed aliases in /alias
Browse files Browse the repository at this point in the history
  • Loading branch information
y3n4 committed Nov 29, 2024
1 parent 5a5db6b commit 6177205
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/Controller/AliasController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class AliasController extends AbstractController
public function __construct(
private readonly AliasHandler $aliasHandler,
private readonly EntityManagerInterface $manager,
)
{

}
) {}

#[Route(path: '/alias', name: 'aliases')]
public function alias(Request $request): Response
Expand Down Expand Up @@ -64,8 +61,8 @@ public function alias(Request $request): Response
}

$aliasRepository = $this->manager->getRepository(Alias::class);
$aliasesRandom = $aliasRepository->findByUser($user, true);
$aliasesCustom = $aliasRepository->findByUser($user, false);
$aliasesRandom = $aliasRepository->findByUser($user, true, true);
$aliasesCustom = $aliasRepository->findByUser($user, false, true);

return $this->render(
'Start/aliases.html.twig',
Expand Down
8 changes: 7 additions & 1 deletion src/Repository/AliasRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ public function findOneBySource(string $email, ?bool $includeDeleted = false): ?
* @param bool|null $random
* @return array|Alias[]
*/
public function findByUser(User $user, ?bool $random = null): array
public function findByUser(User $user, ?bool $random = null, ?bool $disableDomainFilter = false): array
{
$filters = $this->getEntityManager()->getFilters();

if ($filters->isEnabled('domain_filter') && $disableDomainFilter == true) {
$filters->disable('domain_filter');
}

if (isset($random)) {
return $this->findBy(['user' => $user, 'random' => $random, 'deleted' => false]);
}
Expand Down

0 comments on commit 6177205

Please sign in to comment.