summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/templates/meta/html_head_javascript.html1
-rw-r--r--askbot/templates/question.html5
-rw-r--r--askbot/views/writers.py8
3 files changed, 11 insertions, 3 deletions
diff --git a/askbot/templates/meta/html_head_javascript.html b/askbot/templates/meta/html_head_javascript.html
index 09362baa..306f325a 100644
--- a/askbot/templates/meta/html_head_javascript.html
+++ b/askbot/templates/meta/html_head_javascript.html
@@ -19,6 +19,7 @@
askbot['data']['userIsAuthenticated'] = false;
askbot['data']['userReputation'] = 0;
{% endif %}
+ askbot['data']['maxCommentLength'] = {{settings.MAX_COMMENT_LENGTH}};
askbot['urls'] = {};
askbot['settings'] = {};
askbot['settings']['editorType'] = '{{ settings.EDITOR_TYPE }}';
diff --git a/askbot/templates/question.html b/askbot/templates/question.html
index 57c71068..5a317707 100644
--- a/askbot/templates/question.html
+++ b/askbot/templates/question.html
@@ -63,7 +63,10 @@
var answer_id = 'post-id-' + post_id;
var answer_container = document.getElementById(answer_id);
var answer_element= answer_container.getElementsByClassName('answer-body')[0].children[1];
- if (answer_element.textContent.length > 300){
+ if (
+ answer_element.textContent.length >
+ askbot['data']['maxCommentLength']
+ ){
convert_answer.parentNode.removeChild(convert_answer);
}
} else{
diff --git a/askbot/views/writers.py b/askbot/views/writers.py
index da4ce6a1..fadacd1f 100644
--- a/askbot/views/writers.py
+++ b/askbot/views/writers.py
@@ -772,7 +772,7 @@ def answer_to_comment(request):
answer_id = int(answer_id)
answer = get_object_or_404(models.Post,
post_type = 'answer', id=answer_id)
- if len(answer.text) <= 300:
+ if len(answer.text) <= askbot_settings.MAX_COMMENT_LENGTH:
answer.post_type = 'comment'
answer.parent = answer.thread._question_post()
#can we trust this?
@@ -790,7 +790,11 @@ def answer_to_comment(request):
answer.thread.invalidate_cached_data()
else:
- request.user.message_set.create(message = _("the selected answer cannot be a comment"))
+ message = _(
+ 'Cannot convert, because text has more characters than '
+ '%(max_chars)s - maximum allowed for comments'
+ ) % askbot_settings.MAX_COMMENT_LENGTH
+ request.user.message_set.create(message=message)
return HttpResponseRedirect(answer.get_absolute_url())
else: