Fix filter by tag

Fixed filter by non-existent tag
This commit is contained in:
Sam Rzhevsky 2022-11-30 21:13:58 +03:00
parent b4f720cf21
commit 9bddf5940b
No known key found for this signature in database
GPG key ID: 336BC733A67103E9

View file

@ -345,7 +345,7 @@ class MediaRepository
protected function getMediaIdsByTagId($tagId) protected function getMediaIdsByTagId($tagId)
{ {
$mediaIds = $this->db->query('SELECT `upload_id` FROM `uploads_tags` WHERE `tag_id` = ?', $tagId)->fetchAll(); $mediaIds = $this->db->query('SELECT `upload_id` FROM `uploads_tags` WHERE `tag_id` = ?', $tagId)->fetchAll();
$ids = []; $ids = [-1];
foreach ($mediaIds as $pivot) { foreach ($mediaIds as $pivot) {
$ids[] = $pivot->upload_id; $ids[] = $pivot->upload_id;
} }