feat: edit approval

This commit is contained in:
Pascal Engélibert 2022-12-29 22:46:21 +01:00
commit 0c3ea546fd
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
9 changed files with 750 additions and 185 deletions

View file

@ -16,42 +16,76 @@
{% if comments_pending %}
<div id="comments_pending">
{% for comment in comments_pending %}
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
{% if comment.addr %}
<span class="comment-addr">{{ comment.addr }}</span>
{% endif %}
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.editable %}
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
{% if comment.addr %}
<span class="comment-addr">{{ comment.addr }}</span>
{% endif %}
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.last_edit_time %}
<span class="comment-date">{{ comment.last_edit_time | date(format="%F %R", locale=time_lang) }}</span>
{% endif %}
{% if comment.editable %}
{% if comment.original %}
<a href="?edit_edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit-edit")|safe }}</a>
{% else %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin and comment.needs_approval %}
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% if admin %}
{% if comment.needs_approval %}
{% if comment.original %}
<a href="?approve_edit={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve-edit")|safe }}</a>
{% else %}
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% endif %}
{% if comment.original %}
<a href="?remove_edit={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove-edit")|safe }}</a>
{% else %}
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
{% if admin and comment.original %}
<div class="comment comment_original" id="comment-{{ comment.id | safe }}-original">
<span class="comment-author">{{ comment.original.author }}</span>
<span class="comment-date">{{ comment.original.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.original.last_edit_time %}
<span class="comment-date">{{ comment.original.last_edit_time | date(format="%F %R", locale=time_lang) }}</span>
{% endif %}
{% if comment.editable %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin %}
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
<p class="comment-text">{{ comment.original.text }}</p>
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
<div id="comments">
{% for comment in comments %}
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.editable %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin and comment.needs_approval %}
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% if admin %}
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
</div>
<div class="comment{% if comment.needs_approval %} comment_pending{% endif %}" id="comment-{{ comment.id | safe }}">
<span class="comment-author">{{ comment.author }}</span>
<span class="comment-date">{{ comment.post_time | date(format="%F %R", locale=time_lang) }}</span>
{% if comment.last_edit_time %}
<span class="comment-date">{{ comment.last_edit_time | date(format="%F %R", locale=time_lang) }}</span>
{% endif %}
{% if comment.editable %}
<a href="?edit={{ comment.id | safe }}#edit_comment-form">{{ tr(l=l,k="admin-comment-edit")|safe }}</a>
{% endif %}
{% if admin and comment.needs_approval %}
<a href="?approve={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-approve")|safe }}</a>
{% endif %}
{% if admin %}
<a href="?remove={{ comment.id | safe }}">{{ tr(l=l,k="admin-comment-remove")|safe }}</a>
{% endif %}
<p class="comment-text">{{ comment.text }}</p>
</div>
{% endfor %}
</div>
<form id="new_comment-form" action="#new_comment-form" method="post">