mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
add poster event support #18
This commit is contained in:
parent
bd5191e894
commit
706ea40eec
12 changed files with 681 additions and 14 deletions
|
|
@ -56,6 +56,11 @@ class ActivityService
|
|||
Activity::EVENT_TORRENT_SENSITIVE_APPROVE_ADD,
|
||||
Activity::EVENT_TORRENT_SENSITIVE_APPROVE_DELETE,
|
||||
|
||||
Activity::EVENT_TORRENT_POSTER_ADD,
|
||||
Activity::EVENT_TORRENT_POSTER_DELETE,
|
||||
Activity::EVENT_TORRENT_POSTER_APPROVE_ADD,
|
||||
Activity::EVENT_TORRENT_POSTER_APPROVE_DELETE,
|
||||
|
||||
Activity::EVENT_TORRENT_STAR_ADD,
|
||||
Activity::EVENT_TORRENT_STAR_DELETE,
|
||||
|
||||
|
|
@ -321,6 +326,55 @@ class ActivityService
|
|||
|
||||
break;
|
||||
|
||||
/// Torrent poster
|
||||
case Activity::EVENT_TORRENT_POSTER_ADD:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrent poster')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Added')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
case Activity::EVENT_TORRENT_POSTER_DELETE:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrent poster')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Deleted')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
case Activity::EVENT_TORRENT_POSTER_APPROVE_ADD:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrent poster')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Approved')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
case Activity::EVENT_TORRENT_POSTER_APPROVE_DELETE:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrent poster')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Disapproved')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
/// Torrent stars
|
||||
case Activity::EVENT_TORRENT_STAR_ADD:
|
||||
|
||||
|
|
@ -1397,4 +1451,153 @@ class ActivityService
|
|||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
/// Torrent poster
|
||||
public function addEventTorrentPosterAdd(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added,
|
||||
int $torrentPosterId,
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_POSTER_ADD
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$activity->setData(
|
||||
[
|
||||
'torrentPosterId' => $torrentPosterId
|
||||
]
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
public function addEventTorrentPosterDelete(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added,
|
||||
int $torrentPosterId,
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_POSTER_DELETE
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$activity->setData(
|
||||
[
|
||||
'torrentPosterId' => $torrentPosterId
|
||||
]
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
public function addEventTorrentPosterApproveAdd(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added,
|
||||
int $torrentPosterId,
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_POSTER_APPROVE_ADD
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$activity->setData(
|
||||
[
|
||||
'torrentPosterId' => $torrentPosterId
|
||||
]
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
public function addEventTorrentPosterApproveDelete(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added,
|
||||
int $torrentPosterId,
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_POSTER_APPROVE_DELETE
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$activity->setData(
|
||||
[
|
||||
'torrentPosterId' => $torrentPosterId
|
||||
]
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue