This commit is contained in:
x
2024-06-10 01:56:51 +02:00
parent b6d93f54ef
commit c05bcb758f
4 changed files with 15 additions and 2 deletions

View File

@@ -369,6 +369,7 @@ class UserController extends Controller
return view('video', [
'video' => $vid,
'related' => $user,
'isTag' => false,
'banner' => Banner::getRandom($vid->isSfw()),
'sfw' => $sfw
]);
@@ -435,6 +436,7 @@ class UserController extends Controller
return view('video', [
'video' => $vid,
'related' => $user,
'isTag' => false,
'banner' => Banner::getRandom($vid->isSfw()),
'sfw' => $sfw,
]);

View File

@@ -68,6 +68,17 @@ class Video extends Model
return $this->belongsToMany(User::class, 'favorites', 'video_id', 'user_id');
}
public function hasAllTags($tags) {
$tags = app(TagService::class)->buildTagArrayNormalized($tags);
$videotags = $this->getTagArrayNormalizedAttribute();
foreach ($tags as $t) {
if (!in_array($t,$videotags)) {
return false;
}
}
return true;
}
public static function getFirstId($related = null, $isTag = false) {
if ($related) {
if (!$isTag) {

View File

@@ -28,7 +28,7 @@
@if($edit = auth()->check() && auth()->user()->can('edit_video'))
<form action="/index/{{$video->id}}" method="post" id="edit_{{$video->id}}" class="indexform"></form>
@endif
@if(isset($q))
@if(isset($q) && $video->hasAllTags($q))
<span class="vinfo vid"><a href="/t/{{$q}}/{{$video->id}}">{{$video->id}}</a></span>
@else
<span class="vinfo vid"><a href="{{url($video->id)}}">{{$video->id}}</a></span>

View File

@@ -16,7 +16,7 @@
$thumb = str_replace(".webm","",$video->file);
?>
<div class="main-item">
@if(isset($q))
@if(isset($q) && $video->hasAllTags($q))
<a href="/t/{{$q}}/{{$video->id}}">
@else
<a href="/{{$video->id}}">