Implement comment hiding
Currently hides replies too, even comments from users who are logged in.
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
{% from 'moderator.html' import moderate_comment with context -%}
|
||||
|
||||
{%- macro author(id, name, ctime, mtime) -%}
|
||||
<i><a href="{{ url_for('user_info', user_id = id) }}">{{ name }}</a> - {{ format_since(ctime) }}{% if ctime != mtime %} (last modified {{ format_since(mtime) }}){% endif %}</i>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro comment_author(comment, thread_id, can_delete) -%}
|
||||
<span class=small>
|
||||
{{- author(comment.author_id, comment.author, comment.create_time, comment.modify_time) }} |
|
||||
{{- '[hidden]' if comment.hidden else '' }}
|
||||
{{ author(comment.author_id, comment.author, comment.create_time, comment.modify_time) }} |
|
||||
{# Suffixing a # prevents unnecessary reloads #}
|
||||
<a href="{{ url_for('thread', thread_id = thread_id) }}#"> thread</a>
|
||||
{%- if comment.parent_id is not none -%}
|
||||
@@ -15,6 +18,9 @@
|
||||
{%- if can_delete -%}
|
||||
<a href="{{ url_for('confirm_delete_comment', comment_id = comment.id) }}"> delete</a>
|
||||
{%- endif -%}
|
||||
{%- if user.is_moderator() -%}
|
||||
{{ moderate_comment(comment.id, comment.hidden) }}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{%- endmacro -%}
|
||||
|
||||
@@ -5,3 +5,11 @@
|
||||
<input type=submit value="{{ 'Unhide' if hidden else 'Hide' }}">
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro moderate_comment(id, hidden) %}
|
||||
<form method=post action="{{ url_for('set_hide_comment', comment_id = id) }}" style=display:inline>
|
||||
<input name=redirect value="{{ request.full_path }}" hidden>
|
||||
<input name=hide value={{ 0 if hidden else 1 }} hidden>
|
||||
<input type=submit value="{{ 'Unhide' if hidden else 'Hide' }}">
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user