mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
add torrent approved moderation tools
This commit is contained in:
parent
92c2a56bbf
commit
ed6c4ea415
8 changed files with 513 additions and 207 deletions
|
|
@ -43,6 +43,9 @@ class ActivityService
|
|||
// Torrents
|
||||
Activity::EVENT_TORRENT_ADD,
|
||||
|
||||
Activity::EVENT_TORRENT_APPROVE_ADD,
|
||||
Activity::EVENT_TORRENT_APPROVE_DELETE,
|
||||
|
||||
Activity::EVENT_TORRENT_LOCALES_ADD,
|
||||
Activity::EVENT_TORRENT_LOCALES_DELETE,
|
||||
Activity::EVENT_TORRENT_LOCALES_APPROVE_ADD,
|
||||
|
|
@ -191,6 +194,30 @@ class ActivityService
|
|||
|
||||
break;
|
||||
|
||||
case Activity::EVENT_TORRENT_APPROVE_ADD:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrents')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Approved')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
case Activity::EVENT_TORRENT_APPROVE_DELETE:
|
||||
|
||||
$events
|
||||
[
|
||||
$this->translatorInterface->trans('Torrents')
|
||||
]
|
||||
[
|
||||
$this->translatorInterface->trans('Disapproved')
|
||||
] = $code;
|
||||
|
||||
break;
|
||||
|
||||
/// Torrent locales
|
||||
case Activity::EVENT_TORRENT_LOCALES_ADD:
|
||||
|
||||
|
|
@ -760,6 +787,66 @@ class ActivityService
|
|||
return $activity;
|
||||
}
|
||||
|
||||
public function addEventTorrentApproveAdd(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_APPROVE_ADD
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
public function addEventTorrentApproveDelete(
|
||||
int $userId,
|
||||
int $torrentId,
|
||||
int $added
|
||||
): ?Activity
|
||||
{
|
||||
$activity = new Activity();
|
||||
|
||||
$activity->setEvent(
|
||||
Activity::EVENT_TORRENT_APPROVE_DELETE
|
||||
);
|
||||
|
||||
$activity->setUserId(
|
||||
$userId
|
||||
);
|
||||
|
||||
$activity->setTorrentId(
|
||||
$torrentId
|
||||
);
|
||||
|
||||
$activity->setAdded(
|
||||
$added
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($activity);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
/// Torrent Download
|
||||
public function addEventTorrentDownloadFileAdd(
|
||||
int $userId,
|
||||
|
|
|
|||
|
|
@ -298,6 +298,30 @@ class TorrentService
|
|||
return $torrent;
|
||||
}
|
||||
|
||||
public function toggleTorrentApproved(
|
||||
int $torrentId
|
||||
): ?Torrent
|
||||
{
|
||||
$torrent = $this->getTorrent($torrentId);
|
||||
|
||||
$torrent->setApproved(
|
||||
!$torrent->isApproved() // toggle current value
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($torrent);
|
||||
$this->entityManagerInterface->flush();
|
||||
|
||||
$this->updateTorrentLocales(
|
||||
$torrent->getId()
|
||||
);
|
||||
|
||||
$this->updateTorrentSensitive(
|
||||
$torrent->getId()
|
||||
);
|
||||
|
||||
return $torrent;
|
||||
}
|
||||
|
||||
public function getTorrentScrapeQueue(): ?Torrent
|
||||
{
|
||||
return $this->entityManagerInterface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue