From 9bd71af1b21faff1204cc23a69a2f8d9b005641a Mon Sep 17 00:00:00 2001 From: martstern Date: Mon, 22 May 2017 10:18:22 -0400 Subject: [PATCH] only allow logged in users to comment --- nyaa/templates/view.html | 79 +++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 8ba96d6..68471d7 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -136,48 +136,59 @@ Comments - {{ comment_count }} -
- - - {% if g.user.is_admin %} - - {% endif %} - - - - - - {% for comment in comments %} - - {% if g.user.is_admin %} - - {% endif %} - - - - - {% endfor %} - -
DeleteDateUserComment
- - - {% if comment.user %} - - {{ comment.user.username }} - - {% else %} - Anonymous + {% for comment in comments %} +
+
+
+
+

+ {% set user_url = torrent.user and url_for('view_user', user_name=comment.user.username) %} + {{ comment.user.username }} + {% if comment.user.id == torrent.uploader_id and not torrent.anonymous %} + (uploader) {% endif %} -

{{ torrent.created_time.strftime('%Y-%m-%d %H:%M UTC') }}{{ comment.text }}
+

+

{{ comment.user.userlevel_str }}

+

+ +

+ {% if g.user.is_moderator or g.user.id == comment.user_id %} +
+
+ +
+
+ {% endif %} + +
+
+ {{comment.created_time | timesince}}

+ {# Escape newlines into html entities because CF strips blank newlines #} +
{{ comment.text }}
+
+ + + + {% endfor %} -
+{% if g.user %} + {{ form.csrf_token }} {{ render_field(form.comment, class_='form-control') }} - {{ render_field(form.is_anonymous) }}
+{% endif %}