mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-22 20:54:52 +00:00
define torrent add event #4
This commit is contained in:
parent
46d5e25a5f
commit
964dae97aa
@ -179,7 +179,8 @@ class TorrentController extends AbstractController
|
|||||||
Request $request,
|
Request $request,
|
||||||
TranslatorInterface $translator,
|
TranslatorInterface $translator,
|
||||||
UserService $userService,
|
UserService $userService,
|
||||||
TorrentService $torrentService
|
TorrentService $torrentService,
|
||||||
|
ActivityService $activityService
|
||||||
): Response
|
): Response
|
||||||
{
|
{
|
||||||
// Init user
|
// Init user
|
||||||
@ -289,6 +290,12 @@ class TorrentController extends AbstractController
|
|||||||
$user->isApproved()
|
$user->isApproved()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$activityService->addEventTorrentAdd(
|
||||||
|
$user->getId(),
|
||||||
|
time(),
|
||||||
|
$torrent->getId()
|
||||||
|
);
|
||||||
|
|
||||||
// Redirect to info article created
|
// Redirect to info article created
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'torrent_info',
|
'torrent_info',
|
||||||
|
@ -30,7 +30,7 @@ class ActivityService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// User
|
// User
|
||||||
public function addEventUserJoin(
|
public function addEventUserAdd(
|
||||||
int $userId,
|
int $userId,
|
||||||
int $added
|
int $added
|
||||||
): ?Activity
|
): ?Activity
|
||||||
@ -121,6 +121,35 @@ class ActivityService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Torrent
|
// Torrent
|
||||||
|
public function addEventTorrentAdd(
|
||||||
|
int $userId,
|
||||||
|
int $added,
|
||||||
|
int $torrentId
|
||||||
|
): ?Activity
|
||||||
|
{
|
||||||
|
$activity = new Activity();
|
||||||
|
|
||||||
|
$activity->setEvent(
|
||||||
|
Activity::EVENT_TORRENT_ADD
|
||||||
|
);
|
||||||
|
|
||||||
|
$activity->setUserId(
|
||||||
|
$userId
|
||||||
|
);
|
||||||
|
|
||||||
|
$activity->setAdded(
|
||||||
|
$added
|
||||||
|
);
|
||||||
|
|
||||||
|
$activity->setTorrentId(
|
||||||
|
$torrentId
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->entityManagerInterface->persist($activity);
|
||||||
|
$this->entityManagerInterface->flush();
|
||||||
|
|
||||||
|
return $activity;
|
||||||
|
}
|
||||||
|
|
||||||
/// Torrent star
|
/// Torrent star
|
||||||
public function addEventTorrentStarAdd(
|
public function addEventTorrentStarAdd(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user