From 744240d5fd7c67764ba61a2e4b2204dc3320a6bb Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 11 Apr 2013 00:33:18 -0400 Subject: enable/disable accepted answer feature --- askbot/conf/forum_data_rules.py | 9 +++++++++ askbot/doc/source/changelog.rst | 2 ++ askbot/templates/question/answer_vote_buttons.html | 2 ++ askbot/views/commands.py | 2 ++ 4 files changed, 15 insertions(+) diff --git a/askbot/conf/forum_data_rules.py b/askbot/conf/forum_data_rules.py index 362f4735..28a1b7b4 100644 --- a/askbot/conf/forum_data_rules.py +++ b/askbot/conf/forum_data_rules.py @@ -175,6 +175,15 @@ settings.register( ) ) +settings.register( + livesettings.BooleanValue( + FORUM_DATA_RULES, + 'ACCEPTING_ANSWERS_ENABLED', + default=True, + description = _('Enable accepting best answer') + ) +) + settings.register( livesettings.BooleanValue( FORUM_DATA_RULES, diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index 0d5981c6..51c5c5cd 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,8 @@ Changes in Askbot Development version ------------------- +* Disable/enable best answer feature +* Allowed post owners repost answers and comments (this used to be mod-only function). * Answer editor is "folded" by default. Editor buttons and options show on click. * Management command `askbot_import_jive` to import data from Jive forums. * Added possibility to choose editor for comments: plain text, or same as diff --git a/askbot/templates/question/answer_vote_buttons.html b/askbot/templates/question/answer_vote_buttons.html index 242bf2be..cd6f62f0 100644 --- a/askbot/templates/question/answer_vote_buttons.html +++ b/askbot/templates/question/answer_vote_buttons.html @@ -1,4 +1,5 @@ {{ macros.post_vote_buttons(post = answer) }} +{% if settings.ACCEPTING_ANSWERS_ENABLED %}
+{% endif %} diff --git a/askbot/views/commands.py b/askbot/views/commands.py index 133ef70e..b7642440 100644 --- a/askbot/views/commands.py +++ b/askbot/views/commands.py @@ -263,6 +263,8 @@ def vote(request, id): raise Exception(_('Sorry, something is not right here...')) if vote_type == '0': + if askbot_settings.ACCEPTING_ANSWERS_ENABLED is False: + return if request.user.is_authenticated(): answer_id = request.POST.get('postId') answer = get_object_or_404(models.Post, post_type='answer', id = answer_id) -- cgit v1.2.3-1-g7c22