mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
add torrent star event support #4
This commit is contained in:
parent
ef84fefca3
commit
a3dd5a81a9
7 changed files with 174 additions and 6 deletions
|
|
@ -1005,7 +1005,8 @@ class TorrentController extends AbstractController
|
|||
Request $request,
|
||||
TranslatorInterface $translator,
|
||||
UserService $userService,
|
||||
TorrentService $torrentService
|
||||
TorrentService $torrentService,
|
||||
ActivityService $activityService
|
||||
): Response
|
||||
{
|
||||
// Init user
|
||||
|
|
@ -1028,12 +1029,31 @@ class TorrentController extends AbstractController
|
|||
}
|
||||
|
||||
// Update
|
||||
$torrentService->toggleTorrentStar(
|
||||
$value = $torrentService->toggleTorrentStar(
|
||||
$torrent->getId(),
|
||||
$user->getId(),
|
||||
time()
|
||||
);
|
||||
|
||||
// Register activity event
|
||||
if ($value)
|
||||
{
|
||||
$activityService->addEventTorrentStarAdd(
|
||||
$user->getId(),
|
||||
time(),
|
||||
$torrent->getId()
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$activityService->addEventTorrentStarDelete(
|
||||
$user->getId(),
|
||||
time(),
|
||||
$torrent->getId()
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_info',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue