implement torrent statuses management #28

This commit is contained in:
ghost 2023-10-27 01:36:50 +03:00
parent 3cbc6ea90f
commit 989f2f3311
64 changed files with 1051 additions and 282 deletions

View file

@ -62,6 +62,9 @@ class ActivityService
Activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD,
Activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD,
Activity::EVENT_TORRENT_STATUS_ADD,
Activity::EVENT_TORRENT_STATUS_DELETE,
Activity::EVENT_TORRENT_WANTED_ADD,
];
}
@ -379,6 +382,30 @@ class ActivityService
] = $code;
break;
case Activity::EVENT_TORRENT_STATUS_ADD:
$events
[
$this->translatorInterface->trans('Torrents')
]
[
$this->translatorInterface->trans('Enabled')
] = $code;
break;
case Activity::EVENT_TORRENT_STATUS_DELETE:
$events
[
$this->translatorInterface->trans('Torrents')
]
[
$this->translatorInterface->trans('Disabled')
] = $code;
break;
}
}
@ -861,6 +888,65 @@ class ActivityService
return $activity;
}
public function addEventTorrentStatusAdd(
int $userId,
int $torrentId,
int $added
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_STATUS_ADD
);
$activity->setUserId(
$userId
);
$activity->setTorrentId(
$torrentId
);
$activity->setAdded(
$added
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
public function addEventTorrentStatusDelete(
int $userId,
int $torrentId,
int $added
): ?Activity
{
$activity = new Activity();
$activity->setEvent(
Activity::EVENT_TORRENT_STATUS_DELETE
);
$activity->setUserId(
$userId
);
$activity->setTorrentId(
$torrentId
);
$activity->setAdded(
$added
);
$this->entityManagerInterface->persist($activity);
$this->entityManagerInterface->flush();
return $activity;
}
public function addEventTorrentWantedAdd(
int $userId,