Browse Source

fix session variables

main
ghost 1 year ago
parent
commit
924137f09a
  1. 5
      src/Controller/TorrentController.php
  2. 6
      src/Controller/UserController.php
  3. 2
      templates/default/torrent/info.html.twig
  4. 16
      templates/default/user/info.html.twig

5
src/Controller/TorrentController.php

@ -109,10 +109,7 @@ class TorrentController extends AbstractController
[ [
'session' => 'session' =>
[ [
'user' => $user 'user' => $user,
],
'user' =>
[
'id' => $user->getId(), 'id' => $user->getId(),
'moderator' => $user->isModerator() 'moderator' => $user->isModerator()
], ],

6
src/Controller/UserController.php

@ -210,11 +210,13 @@ class UserController extends AbstractController
[ [
'session' => 'session' =>
[ [
'user' => $user 'user' => $user,
'owner' => $user->getId() === $userTarget->getId(),
'moderator' => $user->isModerator()
], ],
'user' => [ 'user' => [
'id' => $userTarget->getId(), 'id' => $userTarget->getId(),
'address' => $userTarget->getId() === $user->getId() ? $userTarget->getAddress() : false, 'address' => $userTarget->getAddress(),
'moderator' => $userTarget->isModerator(), 'moderator' => $userTarget->isModerator(),
'approved' => $userTarget->isApproved(), 'approved' => $userTarget->isApproved(),
'status' => $userTarget->isStatus(), 'status' => $userTarget->isStatus(),

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

@ -73,7 +73,7 @@
</div> </div>
<table class="width-100"> <table class="width-100">
<tbody> <tbody>
{% if user.moderator %} {% if session.moderator %}
<tr> <tr>
<td colspan="2"> <td colspan="2">
<div class="padding-y-8-px border-bottom-default text-right"> <div class="padding-y-8-px border-bottom-default text-right">

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

@ -33,7 +33,7 @@
<tr> <tr>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td> <td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td>
</tr> </tr>
{% if user.address %} {% if session.owner or session.moderator %}
<tr> <tr>
<td class="padding-t-16-px">{{ 'Address' | trans }}</td> <td class="padding-t-16-px">{{ 'Address' | trans }}</td>
<td class="padding-t-16-px"> <td class="padding-t-16-px">
@ -68,7 +68,7 @@
<td class="padding-t-16-px"> <td class="padding-t-16-px">
{% if user.status %} {% if user.status %}
{{ 'Active' | trans }} {{ 'Active' | trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/> <path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
@ -77,7 +77,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{{ 'Disabled' | trans }} {{ 'Disabled' | trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right text-color-red" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right text-color-red" href="{{ path('user_status_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/> <path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>
@ -94,7 +94,7 @@
<td> <td>
{% if user.approved %} {% if user.approved %}
{{ 'Yes'| trans }} {{ 'Yes'| trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/> <path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
@ -103,7 +103,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{{ 'No'| trans }} {{ 'No'| trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right text-color-red" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right text-color-red" href="{{ path('user_approved_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/> <path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>
@ -118,9 +118,9 @@
{{ 'Moderator' | trans }} {{ 'Moderator' | trans }}
</td> </td>
<td> <td>
{% if user.moderator %} {% if session.moderator %}
{{ 'Yes'| trans }} {{ 'Yes'| trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/> <path d="M5 3a5 5 0 0 0 0 10h6a5 5 0 0 0 0-10H5zm6 9a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/>
@ -129,7 +129,7 @@
{% endif %} {% endif %}
{% else %} {% else %}
{{ 'No'| trans }} {{ 'No'| trans }}
{% if user.moderator %} {% if session.moderator %}
<a class="float-right text-color-red" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}"> <a class="float-right text-color-red" href="{{ path('user_moderator_toggle', { userId : user.id }) }}" title="{{ 'Toggle' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/> <path d="M11 4a4 4 0 0 1 0 8H8a4.992 4.992 0 0 0 2-4 4.992 4.992 0 0 0-2-4h3zm-6 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM0 8a5 5 0 0 0 5 5h6a5 5 0 0 0 0-10H5a5 5 0 0 0-5 5z"/>

Loading…
Cancel
Save