Merge remote-tracking branch 'refs/remotes/dthompson/453_disable_comments'
This commit is contained in:
commit
94fadafe09
@ -34,6 +34,9 @@ allow_registration = boolean(default=True)
|
|||||||
# tag parsing
|
# tag parsing
|
||||||
tags_max_length = integer(default=255)
|
tags_max_length = integer(default=255)
|
||||||
|
|
||||||
|
# Enable/disable comments
|
||||||
|
allow_comments = boolean(default=True)
|
||||||
|
|
||||||
# Whether comments are ascending or descending
|
# Whether comments are ascending or descending
|
||||||
comments_ascending = boolean(default=True)
|
comments_ascending = boolean(default=True)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
{%- endtrans -%}
|
{%- endtrans -%}
|
||||||
</p>
|
</p>
|
||||||
{% include "mediagoblin/utils/prev_next.html" %}
|
{% include "mediagoblin/utils/prev_next.html" %}
|
||||||
<div class="media_pane">
|
<div class="media_pane">
|
||||||
<div class="media_image_container">
|
<div class="media_image_container">
|
||||||
{% block mediagoblin_media %}
|
{% block mediagoblin_media %}
|
||||||
{% set display_media = request.app.public_store.file_url(
|
{% set display_media = request.app.public_store.file_url(
|
||||||
@ -71,7 +71,7 @@
|
|||||||
{{ media.title }}
|
{{ media.title }}
|
||||||
</h2>
|
</h2>
|
||||||
{% if request.user and
|
{% if request.user and
|
||||||
(media.uploader == request.user.id or
|
(media.uploader == request.user.id or
|
||||||
request.user.is_admin) %}
|
request.user.is_admin) %}
|
||||||
{% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
|
{% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
|
||||||
user= media.get_uploader.username,
|
user= media.get_uploader.username,
|
||||||
@ -90,11 +90,13 @@
|
|||||||
{% if not request.user %}
|
{% if not request.user %}
|
||||||
href="{{ request.urlgen('mediagoblin.auth.login') }}"
|
href="{{ request.urlgen('mediagoblin.auth.login') }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
class="button_action" id="button_addcomment" title="Add a comment">
|
{% if app_config['allow_comments'] %}
|
||||||
{% trans %}Add a comment{% endtrans %}
|
class="button_action" id="button_addcomment" title="Add a comment">
|
||||||
|
{% trans %}Add a comment{% endtrans %}
|
||||||
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
{% if request.user %}
|
{% if request.user %}
|
||||||
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
|
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
|
||||||
user= media.get_uploader.username,
|
user= media.get_uploader.username,
|
||||||
media_id=media.id) }}" method="POST" id="form_comment">
|
media_id=media.id) }}" method="POST" id="form_comment">
|
||||||
{{ wtforms_util.render_divs(comment_form) }}
|
{{ wtforms_util.render_divs(comment_form) }}
|
||||||
@ -160,7 +162,7 @@
|
|||||||
{% include "mediagoblin/utils/license.html" %}
|
{% include "mediagoblin/utils/license.html" %}
|
||||||
|
|
||||||
{% include "mediagoblin/utils/exif.html" %}
|
{% include "mediagoblin/utils/exif.html" %}
|
||||||
|
|
||||||
{%- if media.attachment_files|count %}
|
{%- if media.attachment_files|count %}
|
||||||
<h3>{% trans %}Attachments{% endtrans %}</h3>
|
<h3>{% trans %}Attachments{% endtrans %}</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -161,7 +161,13 @@ def media_post_comment(request, media):
|
|||||||
comment.author = request.user.id
|
comment.author = request.user.id
|
||||||
comment.content = unicode(request.form['comment_content'])
|
comment.content = unicode(request.form['comment_content'])
|
||||||
|
|
||||||
if not comment.content.strip():
|
# Show error message if commenting is disabled.
|
||||||
|
if not mg_globals.app_config['allow_comments']:
|
||||||
|
messages.add_message(
|
||||||
|
request,
|
||||||
|
messages.ERROR,
|
||||||
|
_("Sorry, comments are disabled."))
|
||||||
|
elif not comment.content.strip():
|
||||||
messages.add_message(
|
messages.add_message(
|
||||||
request,
|
request,
|
||||||
messages.ERROR,
|
messages.ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user