torrent detail show tags

This commit is contained in:
xiaomlove
2022-09-17 20:38:54 +08:00
parent 1a0ad86b32
commit cbd6f2c00d
7 changed files with 40 additions and 21 deletions

View File

@@ -3320,10 +3320,7 @@ function torrenttable($rows, $variant = "torrent", $searchBoxId = 0) {
$torrentSeedingLeechingStatus = $torrent->listLeechingSeedingStatus($CURUSER['id'], $torrentIdArr);
$tagRep = new \App\Repositories\TagRepository();
$tagCollection = $tagRep->createBasicQuery()->get();
$tagIdStr = $tagCollection->implode('id', ',') ?: '0';
$torrentTagCollection = \App\Models\TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->orderByRaw("field(tag_id,$tagIdStr)")->get();
$tagKeyById = $tagCollection->keyBy('id');
$torrentTagCollection = \App\Models\TorrentTag::query()->whereIn('torrent_id', $torrentIdArr)->get();
$torrentTagResult = $torrentTagCollection->groupBy('torrent_id');
$showCover = false;
$showSeedBoxIcon = get_setting('seed_box.enabled') == 'yes';
@@ -3573,7 +3570,7 @@ foreach ($rows as $row)
*/
$tagOwns = $torrentTagResult->get($id);
if ($tagOwns) {
$tags = $tagRep->renderSpan($tagKeyById, $tagOwns->pluck('tag_id')->toArray());
$tags = $tagRep->renderSpan($tagOwns->pluck('tag_id')->toArray());
} else {
$tags = '';
}