Remove my snips from public snips
Remove home button and redirect to snip_index
This commit is contained in:
parent
df708aa931
commit
f20608082a
@ -11,9 +11,6 @@ class HomeController extends AbstractController
|
||||
#[Route('/', name: 'home')]
|
||||
public function home(): Response
|
||||
{
|
||||
// return $this->redirectToRoute('task_view');
|
||||
return $this->render('simple.html.twig', [
|
||||
'text' => 'Welcome!'
|
||||
]);
|
||||
return $this->redirectToRoute('snip_index');
|
||||
}
|
||||
}
|
@ -37,7 +37,7 @@ class SnipController extends AbstractController
|
||||
public function public(): Response
|
||||
{
|
||||
return $this->render('snip/index.html.twig', [
|
||||
'snips' => $this->repository->findPublic(),
|
||||
'snips' => $this->repository->findPublic($this->getUser()),
|
||||
'title' => 'Public Snips'
|
||||
]);
|
||||
}
|
||||
|
@ -50,11 +50,13 @@ class SnipRepository extends ServiceEntityRepository
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function findPublic(): array
|
||||
public function findPublic(User $user): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('s');
|
||||
$qb->where('s.public = :public')
|
||||
->andWhere('s.createdBy != :user')
|
||||
->setParameter('public', true)
|
||||
->setParameter('user', $user)
|
||||
->orderBy('s.createdAt', 'DESC');
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
|
@ -8,10 +8,6 @@
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbar">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('home') }}">Home</a>
|
||||
</li>
|
||||
|
||||
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('snip_index') }}">My snips</a>
|
||||
|
Loading…
Reference in New Issue
Block a user