Skip to content

Commit

Permalink
Merge pull request #10705 from nanaya/forum-show-variable
Browse files Browse the repository at this point in the history
Skip subforum count query and add current user variable
  • Loading branch information
notbakaneko authored Nov 7, 2023
2 parents 6f5188e + 051b0d8 commit 10db665
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions resources/views/forum/forums/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
])

@php
$currentUserId = Auth::user()?->getKey();
$currentUser = Auth::user();
$currentUserId = $currentUser?->getKey();
$subforums = $forum->subforums;
@endphp
@section('content')
@include('forum._header', [
Expand All @@ -33,7 +35,7 @@
</p>
</div>

@if ($forum->subforums()->exists())
@if (count($subforums) > 0)
<div class="forum-list">
<h2 class="title title--forum">{{ osu_trans("forum.subforums") }}</h2>

Expand All @@ -46,7 +48,7 @@
{{ osu_trans('forum.forums.latest_post') }}
</div>
</li>
@foreach ($forum->subforums as $subforum)
@foreach ($subforums as $subforum)
@include('forum.forums._forum', ['currentUserId' => $currentUserId, 'forum' => $subforum])
@endforeach
</ul>
Expand Down Expand Up @@ -132,7 +134,7 @@ class="simple-menu simple-menu--forum-list js-click-menu"
@endif
</div>

@if (auth()->check() && auth()->user()->isAdmin())
@if ($currentUser !== null && $currentUser->isAdmin())
<div class="admin-menu">
<button class="admin-menu__button js-menu" data-menu-target="admin-menu-forums-show">
<span class="fas fa-angle-up"></span>
Expand Down

0 comments on commit 10db665

Please sign in to comment.