fix: add torrents to external tracker immediately

Otherwise, we get errors when deleting pending torrents.
This commit is contained in:
Roardom
2024-04-19 13:35:45 +00:00
parent 8e8c373884
commit f61364f803
2 changed files with 5 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ use App\Models\Tv;
use App\Models\User;
use App\Repositories\ChatRepository;
use App\Services\Tmdb\TMDBScraper;
use App\Services\Unit3dAnnounce;
use App\Traits\TorrentMeta;
use Exception;
use Illuminate\Http\Request;
@@ -313,6 +314,8 @@ class TorrentController extends BaseController
// Save The Torrent
$torrent->save();
Unit3dAnnounce::addTorrent($torrent);
// Set torrent to featured
if ($torrent->featured == 1) {
$featuredTorrent = new FeaturedTorrent();

View File

@@ -408,6 +408,8 @@ class TorrentController extends Controller
'moderated_by' => User::SYSTEM_USER_ID,
] + $request->safe()->except(['torrent']));
Unit3dAnnounce::addTorrent($torrent);
// Count and save the torrent number in this category
$category = Category::findOrFail($request->integer('category_id'));
$category->num_torrent = $category->torrents()->count();