Enforce blog posts not allowing commenting on them
This commit is contained in:
parent
21dbede734
commit
c665db20b8
|
@ -81,6 +81,7 @@
|
||||||
{{ include_page("comment.partial_index",
|
{{ include_page("comment.partial_index",
|
||||||
thread="blog-"+post["post_id"]|string,
|
thread="blog-"+post["post_id"]|string,
|
||||||
subject=post["subject"],
|
subject=post["subject"],
|
||||||
|
addable=post["comments"],
|
||||||
) | safe }}
|
) | safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -168,8 +168,13 @@ def unsubscribe():
|
||||||
return template("comment/unsubscribed.html")
|
return template("comment/unsubscribed.html")
|
||||||
|
|
||||||
|
|
||||||
def partial_index(thread, subject, header=True):
|
def partial_index(thread, subject, header=True, addable=True):
|
||||||
"""Partial template for including the index view of a comment thread."""
|
"""Partial template for including the index view of a comment thread.
|
||||||
|
|
||||||
|
* thread: unique name for the comment thread
|
||||||
|
* subject: subject name for the comment thread
|
||||||
|
* header: show the Comments h1 header
|
||||||
|
* addable: boolean, can new comments be added to the thread"""
|
||||||
|
|
||||||
comments = Comment.get_comments(thread)
|
comments = Comment.get_comments(thread)
|
||||||
|
|
||||||
|
@ -199,6 +204,7 @@ def partial_index(thread, subject, header=True):
|
||||||
g.info["header"] = header
|
g.info["header"] = header
|
||||||
g.info["thread"] = thread
|
g.info["thread"] = thread
|
||||||
g.info["subject"] = subject
|
g.info["subject"] = subject
|
||||||
|
g.info["commenting_disabled"] = not addable
|
||||||
g.info["url"] = request.url
|
g.info["url"] = request.url
|
||||||
g.info["comments"] = sorted_comments
|
g.info["comments"] = sorted_comments
|
||||||
g.info["photo_url"] = Config.photo.root_public
|
g.info["photo_url"] = Config.photo.root_public
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{# Common template for leaving a comment/updating the comment preview. #}
|
{# Common template for leaving a comment/updating the comment preview. #}
|
||||||
|
|
||||||
|
{% if commenting_disabled %}
|
||||||
|
No new comments may be added to this thread.
|
||||||
|
{% else %}
|
||||||
<form name="comment" action="{{ url_for('comment.preview') }}" method="POST">
|
<form name="comment" action="{{ url_for('comment.preview') }}" method="POST">
|
||||||
<input type="hidden" name="token" value="{{ csrf_token() }}">
|
<input type="hidden" name="token" value="{{ csrf_token() }}">
|
||||||
<input type="hidden" name="thread" value="{{ thread }}">
|
<input type="hidden" name="thread" value="{{ thread }}">
|
||||||
|
@ -64,3 +67,4 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user