Browse Source

implement approved/sensitive access behavior

main
ghost 1 year ago
parent
commit
60a5593446
  1. 392
      src/Controller/ActivityController.php
  2. 68
      src/Controller/TorrentController.php
  3. 4
      src/Controller/UserController.php
  4. 21
      templates/default/activity/event/torrent/add.html.twig
  5. 21
      templates/default/activity/event/torrent/approve/add.html.twig
  6. 21
      templates/default/activity/event/torrent/approve/delete.html.twig
  7. 21
      templates/default/activity/event/torrent/download/file/add.html.twig
  8. 21
      templates/default/activity/event/torrent/download/magnet/add.html.twig
  9. 21
      templates/default/activity/event/torrent/locales/add.html.twig
  10. 21
      templates/default/activity/event/torrent/locales/approve/add.html.twig
  11. 21
      templates/default/activity/event/torrent/locales/approve/delete.html.twig
  12. 21
      templates/default/activity/event/torrent/locales/delete.html.twig
  13. 21
      templates/default/activity/event/torrent/sensitive/add.html.twig
  14. 21
      templates/default/activity/event/torrent/sensitive/approve/add.html.twig
  15. 21
      templates/default/activity/event/torrent/sensitive/approve/delete.html.twig
  16. 21
      templates/default/activity/event/torrent/sensitive/delete.html.twig
  17. 21
      templates/default/activity/event/torrent/star/add.html.twig
  18. 21
      templates/default/activity/event/torrent/star/delete.html.twig
  19. 2
      templates/default/activity/list.html.twig
  20. 2
      templates/default/torrent/info.html.twig
  21. 18
      templates/default/torrent/list.html.twig
  22. 2
      templates/default/user/info.html.twig

392
src/Controller/ActivityController.php

@ -43,6 +43,9 @@ class ActivityController extends AbstractController
return $this->render( return $this->render(
'default/activity/list.html.twig', 'default/activity/list.html.twig',
[ [
'session' => [
'user' => $user
],
'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters 'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters
$user->getEvents(), $user->getEvents(),
$this->getParameter('app.pagination'), $this->getParameter('app.pagination'),
@ -59,7 +62,8 @@ class ActivityController extends AbstractController
} }
public function event( public function event(
$activity, \App\Entity\User $user,
\App\Entity\Activity $activity,
ActivityService $activityService, ActivityService $activityService,
UserService $userService, UserService $userService,
TorrentService $torrentService, TorrentService $torrentService,
@ -347,6 +351,12 @@ class ActivityController extends AbstractController
// Torrent // Torrent
case $activity::EVENT_TORRENT_ADD: case $activity::EVENT_TORRENT_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/add.html.twig', 'default/activity/event/torrent/add.html.twig',
[ [
@ -362,10 +372,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -374,6 +396,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_APPROVE_ADD: case $activity::EVENT_TORRENT_APPROVE_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/approve/add.html.twig', 'default/activity/event/torrent/approve/add.html.twig',
[ [
@ -389,10 +417,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -401,6 +441,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_APPROVE_DELETE: case $activity::EVENT_TORRENT_APPROVE_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/approve/delete.html.twig', 'default/activity/event/torrent/approve/delete.html.twig',
[ [
@ -416,10 +462,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -429,6 +487,12 @@ class ActivityController extends AbstractController
// Torrent Download // Torrent Download
case $activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD: case $activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/download/file/add.html.twig', 'default/activity/event/torrent/download/file/add.html.twig',
[ [
@ -444,10 +508,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -456,6 +532,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD: case $activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/download/magnet/add.html.twig', 'default/activity/event/torrent/download/magnet/add.html.twig',
[ [
@ -471,10 +553,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -484,6 +578,12 @@ class ActivityController extends AbstractController
/// Torrent Locales /// Torrent Locales
case $activity::EVENT_TORRENT_LOCALES_ADD: case $activity::EVENT_TORRENT_LOCALES_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/locales/add.html.twig', 'default/activity/event/torrent/locales/add.html.twig',
[ [
@ -499,16 +599,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'locales' => [ 'locales' => [
'id' => $activity->getData()['torrentLocalesId'], 'id' => $activity->getData()['torrentLocalesId'],
'exist' => $torrentService->getTorrentLocales( 'exist' => $torrentService->getTorrentLocales(
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links $activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -517,6 +629,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_LOCALES_DELETE: case $activity::EVENT_TORRENT_LOCALES_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/locales/delete.html.twig', 'default/activity/event/torrent/locales/delete.html.twig',
[ [
@ -532,16 +650,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'locales' => [ 'locales' => [
'id' => $activity->getData()['torrentLocalesId'], 'id' => $activity->getData()['torrentLocalesId'],
'exist' => $torrentService->getTorrentLocales( 'exist' => $torrentService->getTorrentLocales(
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links $activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -550,6 +680,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_LOCALES_APPROVE_ADD: case $activity::EVENT_TORRENT_LOCALES_APPROVE_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/locales/approve/add.html.twig', 'default/activity/event/torrent/locales/approve/add.html.twig',
[ [
@ -565,16 +701,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'locales' => [ 'locales' => [
'id' => $activity->getData()['torrentLocalesId'], 'id' => $activity->getData()['torrentLocalesId'],
'exist' => $torrentService->getTorrentLocales( 'exist' => $torrentService->getTorrentLocales(
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links $activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -583,6 +731,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_LOCALES_APPROVE_DELETE: case $activity::EVENT_TORRENT_LOCALES_APPROVE_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/locales/approve/delete.html.twig', 'default/activity/event/torrent/locales/approve/delete.html.twig',
[ [
@ -598,16 +752,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'locales' => [ 'locales' => [
'id' => $activity->getData()['torrentLocalesId'], 'id' => $activity->getData()['torrentLocalesId'],
'exist' => $torrentService->getTorrentLocales( 'exist' => $torrentService->getTorrentLocales(
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links $activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -617,6 +783,12 @@ class ActivityController extends AbstractController
/// Torrent Sensitive /// Torrent Sensitive
case $activity::EVENT_TORRENT_SENSITIVE_ADD: case $activity::EVENT_TORRENT_SENSITIVE_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/sensitive/add.html.twig', 'default/activity/event/torrent/sensitive/add.html.twig',
[ [
@ -632,16 +804,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'sensitive' => [ 'sensitive' => [
'id' => $activity->getData()['torrentSensitiveId'], 'id' => $activity->getData()['torrentSensitiveId'],
'exist' => $torrentService->getTorrentSensitive( 'exist' => $torrentService->getTorrentSensitive(
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links $activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -650,6 +834,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_SENSITIVE_DELETE: case $activity::EVENT_TORRENT_SENSITIVE_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/sensitive/delete.html.twig', 'default/activity/event/torrent/sensitive/delete.html.twig',
[ [
@ -665,16 +855,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'sensitive' => [ 'sensitive' => [
'id' => $activity->getData()['torrentSensitiveId'], 'id' => $activity->getData()['torrentSensitiveId'],
'exist' => $torrentService->getTorrentSensitive( 'exist' => $torrentService->getTorrentSensitive(
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links $activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -683,6 +885,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_ADD: case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/sensitive/approve/add.html.twig', 'default/activity/event/torrent/sensitive/approve/add.html.twig',
[ [
@ -698,16 +906,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'sensitive' => [ 'sensitive' => [
'id' => $activity->getData()['torrentSensitiveId'], 'id' => $activity->getData()['torrentSensitiveId'],
'exist' => $torrentService->getTorrentSensitive( 'exist' => $torrentService->getTorrentSensitive(
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links $activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -716,6 +936,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_DELETE: case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/sensitive/approve/delete.html.twig', 'default/activity/event/torrent/sensitive/approve/delete.html.twig',
[ [
@ -731,16 +957,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName(), )->getName(),
'sensitive' => [ 'sensitive' => [
'id' => $activity->getData()['torrentSensitiveId'], 'id' => $activity->getData()['torrentSensitiveId'],
'exist' => $torrentService->getTorrentSensitive( 'exist' => $torrentService->getTorrentSensitive(
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links $activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links
) )
] ]
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -750,6 +988,12 @@ class ActivityController extends AbstractController
/// Torrent star /// Torrent star
case $activity::EVENT_TORRENT_STAR_ADD: case $activity::EVENT_TORRENT_STAR_ADD:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/star/add.html.twig', 'default/activity/event/torrent/star/add.html.twig',
[ [
@ -765,10 +1009,22 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
@ -777,6 +1033,12 @@ class ActivityController extends AbstractController
case $activity::EVENT_TORRENT_STAR_DELETE: case $activity::EVENT_TORRENT_STAR_DELETE:
// Init torrent
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId()))
{
throw $this->createNotFoundException();
}
return $this->render( return $this->render(
'default/activity/event/torrent/star/delete.html.twig', 'default/activity/event/torrent/star/delete.html.twig',
[ [
@ -792,18 +1054,28 @@ class ActivityController extends AbstractController
], ],
'torrent' => 'torrent' =>
[ [
'id' => $activity->getTorrentId(), 'id' => $torrent->getId(),
'name' => $torrentService->readTorrentFileByTorrentId( 'sensitive' => $torrent->isSensitive(),
$activity->getTorrentId() 'approved' => $torrent->isApproved(),
'name' => $torrentService->readTorrentFileByTorrentId(
$torrent->getId()
)->getName() )->getName()
],
'session' =>
[
'user' =>
[
'id' => $user->getId(),
'sensitive' => $user->isSensitive(),
'moderator' => $user->isModerator(),
'owner' => $user->getId() === $torrent->getUserId(),
]
] ]
] ]
); );
break; break;
// @TODO Page
default: default:
return $this->render( return $this->render(

68
src/Controller/TorrentController.php

@ -55,6 +55,18 @@ class TorrentController extends AbstractController
throw $this->createNotFoundException(); throw $this->createNotFoundException();
} }
// Sensitive filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && $user->isSensitive())
{
throw $this->createNotFoundException();
}
// Approved filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && !$torrent->isApproved())
{
throw $this->createNotFoundException();
}
// Get contributors // Get contributors
$contributors = []; $contributors = [];
foreach ($torrentService->getTorrentContributors($torrent) as $userId) foreach ($torrentService->getTorrentContributors($torrent) as $userId)
@ -95,6 +107,10 @@ class TorrentController extends AbstractController
// Render template // Render template
return $this->render('default/torrent/info.html.twig', return $this->render('default/torrent/info.html.twig',
[ [
'session' =>
[
'user' => $user
],
'user' => 'user' =>
[ [
'id' => $user->getId(), 'id' => $user->getId(),
@ -215,16 +231,16 @@ class TorrentController extends AbstractController
$total = $torrentService->findTorrentsTotal( $total = $torrentService->findTorrentsTotal(
$query, $query,
$user->getLocales(), $user->getLocales(),
$user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all
$user->isModerator() ? null : true, // show approved content only for regular users !$user->isModerator() ? true : null, // show approved content only for regular users
); );
$torrents = []; $torrents = [];
foreach ($torrentService->findTorrents( foreach ($torrentService->findTorrents(
$query, $query,
$user->getLocales(), $user->getLocales(),
$user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all
$user->isModerator() ? null : true, // show approved content only for regular users !$user->isModerator() ? true : null, // show approved content only for regular users
$this->getParameter('app.pagination'), $this->getParameter('app.pagination'),
($page - 1) * $this->getParameter('app.pagination') ($page - 1) * $this->getParameter('app.pagination')
) as $torrent) ) as $torrent)
@ -247,8 +263,10 @@ class TorrentController extends AbstractController
$torrents[] = $torrents[] =
[ [
'id' => $torrent->getId(), 'id' => $torrent->getId(),
'added' => $torrent->getAdded(), 'added' => $torrent->getAdded(),
'approved' => $torrent->isApproved(),
'sensitive' => $torrent->isSensitive(),
'file' => 'file' =>
[ [
'name' => $file->getName(), 'name' => $file->getName(),
@ -341,8 +359,8 @@ class TorrentController extends AbstractController
$total = $torrentService->findTorrentsTotal( $total = $torrentService->findTorrentsTotal(
[], [],
$user->getLocales(), $user->getLocales(),
$user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all
$user->isModerator() ? null : true, // show approved content only for regular users !$user->isModerator() ? true : null, // show approved content only for regular users
); );
// Create torrents list // Create torrents list
@ -350,8 +368,8 @@ class TorrentController extends AbstractController
foreach ($torrentService->findTorrents( foreach ($torrentService->findTorrents(
[], [],
$user->getLocales(), $user->getLocales(),
$user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all !$user->isModerator() && $user->isSensitive() ? false : null, // hide on sensitive mode enabled or show all
$user->isModerator() ? null : true, // show approved content only for regular users !$user->isModerator() ? true : null, // show approved content only for regular users
$this->getParameter('app.pagination'), $this->getParameter('app.pagination'),
($page - 1) * $this->getParameter('app.pagination') ($page - 1) * $this->getParameter('app.pagination')
) as $torrent) ) as $torrent)
@ -375,8 +393,10 @@ class TorrentController extends AbstractController
$torrents[] = $torrents[] =
[ [
'id' => $torrent->getId(), 'id' => $torrent->getId(),
'added' => $torrent->getAdded(), 'added' => $torrent->getAdded(),
'approved' => $torrent->isApproved(),
'sensitive' => $torrent->isSensitive(),
'file' => 'file' =>
[ [
'name' => $file->getName(), 'name' => $file->getName(),
@ -1480,6 +1500,18 @@ class TorrentController extends AbstractController
); );
} }
// Sensitive filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && $user->isSensitive())
{
throw $this->createNotFoundException();
}
// Approved filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && !$torrent->isApproved())
{
throw $this->createNotFoundException();
}
// Register download // Register download
$torrentService->addTorrentDownloadFile( $torrentService->addTorrentDownloadFile(
$torrent->getId(), $torrent->getId(),
@ -1588,6 +1620,18 @@ class TorrentController extends AbstractController
); );
} }
// Sensitive filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && $user->isSensitive())
{
throw $this->createNotFoundException();
}
// Approved filter
if (!$user->isModerator() && $user->getId() != $torrent->getUserId() && !$torrent->isApproved())
{
throw $this->createNotFoundException();
}
// Register download // Register download
$torrentService->addTorrentDownloadMagnet( $torrentService->addTorrentDownloadMagnet(
$torrent->getId(), $torrent->getId(),

4
src/Controller/UserController.php

@ -208,6 +208,10 @@ class UserController extends AbstractController
return $this->render( return $this->render(
'default/user/info.html.twig', 'default/user/info.html.twig',
[ [
'session' =>
[
'user' => $user
],
'user' => [ 'user' => [
'id' => $userTarget->getId(), 'id' => $userTarget->getId(),
'address' => $userTarget->getId() === $user->getId() ? $userTarget->getAddress() : false, 'address' => $userTarget->getId() === $user->getId() ? $userTarget->getAddress() : false,

21
templates/default/activity/event/torrent/add.html.twig

@ -6,9 +6,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'added torrent' | trans }} {{ 'added torrent' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/approve/add.html.twig

@ -6,9 +6,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'approved torrent' | trans }} {{ 'approved torrent' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/approve/delete.html.twig

@ -6,9 +6,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'disapproved torrent' | trans }} {{ 'disapproved torrent' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/download/file/add.html.twig

@ -6,9 +6,24 @@
<span class="margin-x-l-px"> <span class="margin-x-l-px">
{{ 'downloaded torrent file' | trans }} {{ 'downloaded torrent file' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/download/magnet/add.html.twig

@ -6,9 +6,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'downloaded magnet link' | trans }} {{ 'downloaded magnet link' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/locales/add.html.twig

@ -14,9 +14,24 @@
#{{ torrent.locales.id }} #{{ torrent.locales.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/locales/approve/add.html.twig

@ -12,9 +12,24 @@
#{{ torrent.locales.id }} #{{ torrent.locales.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/locales/approve/delete.html.twig

@ -14,9 +14,24 @@
#{{ torrent.locales.id }} #{{ torrent.locales.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/locales/delete.html.twig

@ -12,9 +12,24 @@
#{{ torrent.locales.id }} #{{ torrent.locales.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/sensitive/add.html.twig

@ -12,9 +12,24 @@
#{{ torrent.sensitive.id }} #{{ torrent.sensitive.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/sensitive/approve/add.html.twig

@ -12,9 +12,24 @@
#{{ torrent.sensitive.id }} #{{ torrent.sensitive.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/sensitive/approve/delete.html.twig

@ -12,9 +12,24 @@
#{{ torrent.sensitive.id }} #{{ torrent.sensitive.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/sensitive/delete.html.twig

@ -12,9 +12,24 @@
#{{ torrent.sensitive.id }} #{{ torrent.sensitive.id }}
{% endif %} {% endif %}
{{ 'for torrent' | trans }} {{ 'for torrent' | trans }}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/star/add.html.twig

@ -6,9 +6,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'added star for torrent' | trans }} {{ 'added star for torrent' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

21
templates/default/activity/event/torrent/star/delete.html.twig

@ -7,9 +7,24 @@
<span class="margin-l-4-px"> <span class="margin-l-4-px">
{{ 'removed star from torrent' | trans }} {{ 'removed star from torrent' | trans }}
</span> </span>
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}"> {% if session.user.moderator or session.user.owner %}
{{ torrent.name }} <a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
</a> {{ torrent.name }}
</a>
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% endif %}
{% else %}
{% if torrent.approved == false %}
#{{ torrent.id }} ({{ 'waiting for approve' | trans }})
{% elseif torrent.sensitive == true %}
#{{ torrent.id }} ({{ 'sensitive' | trans }})
{% else %}
<a href="{{ path('torrent_info', { torrentId : torrent.id }) }}">
{{ torrent.name }}
</a>
{% endif %}
{% endif %}
</div> </div>
<div class="column width-20 text-right"> <div class="column width-20 text-right">
{{ added | format_ago }} {{ added | format_ago }}

2
templates/default/activity/list.html.twig

@ -5,7 +5,7 @@
<div class="padding-16-px margin-y-8-px border-radius-3-px background-color-night"> <div class="padding-16-px margin-y-8-px border-radius-3-px background-color-night">
{{ render(controller( {{ render(controller(
'App\\Controller\\ActivityController::event', 'App\\Controller\\ActivityController::event',
{ activity : activity } { user : session.user, activity : activity }
)) }} )) }}
</div> </div>
{% endfor %} {% endfor %}

2
templates/default/torrent/info.html.twig

@ -340,7 +340,7 @@
<div class="padding-16-px margin-y-8-px border-radius-3-px background-color-night"> <div class="padding-16-px margin-y-8-px border-radius-3-px background-color-night">
{{ render(controller( {{ render(controller(
'App\\Controller\\ActivityController::event', 'App\\Controller\\ActivityController::event',
{ activity : activity } { user : session.user, activity : activity }
)) }} )) }}
</div> </div>
{% endfor %} {% endfor %}

18
templates/default/torrent/list.html.twig

@ -3,7 +3,7 @@
{% block main_content %} {% block main_content %}
{% if torrents %} {% if torrents %}
{% for torrent in torrents %} {% for torrent in torrents %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night"> <div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night{% if torrent.sensitive == true or torrent.approved == false %} opacity-06{% endif %}">
<a name="{{ torrent.id }}"></a> <a name="{{ torrent.id }}"></a>
<div class="margin-b-16-px"> <div class="margin-b-16-px">
<h2> <h2>
@ -12,11 +12,25 @@
</a> </a>
</h2> </h2>
{% if torrent.scrape.leechers == 0 and torrent.scrape.leechers == 0 %} {% if torrent.scrape.leechers == 0 and torrent.scrape.leechers == 0 %}
<span class="label label-green margin-x-4-px font-size-10-px position-relative top--2 cursor-default" <span class="label label-green margin-l-4-px font-size-10-px position-relative top--2 cursor-default"
title="{{ 'Active leechers waiting for seeders' | trans }}"> title="{{ 'Active leechers waiting for seeders' | trans }}">
{{ 'wanted' | trans }} {{ 'wanted' | trans }}
</span> </span>
{% endif %} {% endif %}
{% if torrent.approved == false %}
<sub class="margin-l-8-px float-right" title="{{ 'Waiting for approve' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="M2 1.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1-.5-.5zm2.5.5v1a3.5 3.5 0 0 0 1.989 3.158c.533.256 1.011.791 1.011 1.491v.702c0 .7-.478 1.235-1.011 1.491A3.5 3.5 0 0 0 4.5 13v1h7v-1a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351v-.702c0-.7.478-1.235 1.011-1.491A3.5 3.5 0 0 0 11.5 3V2h-7z"/>
</svg>
</sub>
{% endif %}
{% if torrent.sensitive == true %}
<sub class="margin-l-8-px float-right" title="{{ 'Content visible for non sensitive users only' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="m9.97 4.88.953 3.811C10.159 8.878 9.14 9 8 9c-1.14 0-2.158-.122-2.923-.309L6.03 4.88C6.635 4.957 7.3 5 8 5s1.365-.043 1.97-.12zm-.245-.978L8.97.88C8.718-.13 7.282-.13 7.03.88L6.275 3.9C6.8 3.965 7.382 4 8 4c.618 0 1.2-.036 1.725-.098zm4.396 8.613a.5.5 0 0 1 .037.96l-6 2a.5.5 0 0 1-.316 0l-6-2a.5.5 0 0 1 .037-.96l2.391-.598.565-2.257c.862.212 1.964.339 3.165.339s2.303-.127 3.165-.339l.565 2.257 2.391.598z"/>
</svg>
</sub>
{% endif %}
</div> </div>
{% if torrent.keywords %} {% if torrent.keywords %}
<div class="margin-b-16-px"> <div class="margin-b-16-px">

2
templates/default/user/info.html.twig

@ -232,7 +232,7 @@
<div class="padding-x-24-px padding-y-16-px margin-y-8-px border-radius-3-px background-color-night"> <div class="padding-x-24-px padding-y-16-px margin-y-8-px border-radius-3-px background-color-night">
{{ render(controller( {{ render(controller(
'App\\Controller\\ActivityController::event', 'App\\Controller\\ActivityController::event',
{ activity : activity } { user: session.user, activity : activity }
)) }} )) }}
</div> </div>
{% endfor %} {% endfor %}

Loading…
Cancel
Save