Merge pull request #181 from shikorism/fix/private-like

非公開チェックインに対するいいね関係のバグ修正
This commit is contained in:
shibafu 2019-04-21 02:16:47 +09:00 committed by GitHub
commit 8de5fa891e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -188,6 +188,10 @@ SQL
$likes = $user->likes()
->orderBy('created_at', 'desc')
->with('ejaculation.user', 'ejaculation.tags')
->whereHas('ejaculation', function ($query) {
$query->where('user_id', Auth::id())
->orWhere('is_private', false);
})
->paginate(20);
return view('user.likes')->with(compact('user', 'likes'));

View File

@ -6,8 +6,11 @@
</h5>
</div>
<!-- tags -->
@if ($ejaculation->tags->isNotEmpty())
@if ($ejaculation->is_private || $ejaculation->tags->isNotEmpty())
<p class="mb-2">
@if ($ejaculation->is_private)
<span class="badge badge-warning"><span class="oi oi-lock-locked"></span> 非公開</span>
@endif
@foreach ($ejaculation->tags as $tag)
<a class="badge badge-secondary" href="{{ route('search', ['q' => $tag->name]) }}"><span class="oi oi-tag"></span> {{ $tag->name }}</a>
@endforeach