Browse Source

add torrent contributors info #11

main
ghost 1 year ago
parent
commit
997d9db562
  1. 34
      src/Controller/TorrentController.php
  2. 11
      templates/default/torrent/info.html.twig

34
src/Controller/TorrentController.php

@ -51,13 +51,41 @@ class TorrentController extends AbstractController @@ -51,13 +51,41 @@ class TorrentController extends AbstractController
throw $this->createNotFoundException();
}
// Get contributors
$contributors = [];
$contributors[$torrent->getUserId()] = $userService->identicon(
$userService->get(
$torrent->getUserId()
)->getAddress()
);
if ($torrentLocales = $torrentService->findLastTorrentLocalesByTorrentId($torrent->getId()))
{
$contributors[$torrentLocales->getUserId()] = $userService->identicon(
$userService->get(
$torrentLocales->getUserId()
)->getAddress()
);
}
if ($torrentSensitive = $torrentService->findLastTorrentSensitiveByTorrentId($torrent->getId()))
{
$contributors[$torrentSensitive->getUserId()] = $userService->identicon(
$userService->get(
$torrentSensitive->getUserId()
)->getAddress()
);
}
// Render template
return $this->render('default/torrent/info.html.twig', [
'torrent' =>
[
'id' => $torrent->getId(),
'added' => $torrent->getAdded(),
'user' =>
/*
'user' =>
[
'id' => $torrent->getUserId(),
'identicon' => $userService->identicon(
@ -66,6 +94,7 @@ class TorrentController extends AbstractController @@ -66,6 +94,7 @@ class TorrentController extends AbstractController
)->getAddress()
),
],
*/
'scrape' =>
[
'seeders' => (int) $torrent->getSeeders(),
@ -107,7 +136,8 @@ class TorrentController extends AbstractController @@ -107,7 +136,8 @@ class TorrentController extends AbstractController
$torrent->getId()
)
],
'pages' => []
'pages' => [],
'contributors' => $contributors
],
'file' =>
[

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

@ -179,12 +179,14 @@ @@ -179,12 +179,14 @@
{% endif %}
<tr>
<td>
{{ 'Publisher'|trans }}
{{ 'Contributors'|trans }}
</td>
<td>
<a href="{{ path('user_info', { id : torrent.user.id }) }}">
<img class="border-radius-50 border-color-default vertical-align-middle" src="{{ torrent.user.identicon }}" alt="{{'identicon'|trans }}" />
</a>
{% for id, identicon in torrent.contributors %}
<a href="{{ path('user_info', { id : id }) }}">
<img class="border-radius-50 border-color-default vertical-align-middle" src="{{ identicon }}" alt="{{'identicon'|trans }}" />
</a>
{% endfor %}
</td>
</tr>
<tr>
@ -236,7 +238,6 @@ @@ -236,7 +238,6 @@
</div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="padding-y-8-px border-bottom-default text-right">

Loading…
Cancel
Save