diff options
-rw-r--r-- | askbot/models/__init__.py | 22 | ||||
-rw-r--r-- | askbot/skins/common/media/js/utils.js | 6 | ||||
-rw-r--r-- | askbot/skins/default/media/style/style.less | 22 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/content.html | 11 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/javascript.html | 56 | ||||
-rw-r--r-- | askbot/skins/default/templates/revisions.html | 17 | ||||
-rw-r--r-- | askbot/tests/permission_assertion_tests.py | 6 |
7 files changed, 84 insertions, 56 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index c4c11cb4..ed0d876a 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -837,7 +837,9 @@ def user_assert_can_close_question(self, question = None): def user_assert_can_reopen_question(self, question = None): assert(question.post_type == 'question') + #for some reason rep to reopen own questions != rep to close own q's owner_min_rep_setting = askbot_settings.MIN_REP_TO_REOPEN_OWN_QUESTIONS + min_rep_setting = askbot_settings.MIN_REP_TO_CLOSE_OTHERS_QUESTIONS general_error_message = _( 'Sorry, only administrators, moderators ' @@ -850,15 +852,27 @@ def user_assert_can_reopen_question(self, question = None): 'a minimum reputation of %(min_rep)s is required' ) % {'min_rep': owner_min_rep_setting} + blocked_error_message = _( + 'Sorry, you cannot reopen questions ' + 'because your account is blocked' + ) + + suspended_error_message = _( + 'Sorry, you cannot reopen questions ' + 'because your account is suspended' + ) + _assert_user_can( user = self, post = question, - admin_or_moderator_required = True, owner_can = True, suspended_owner_cannot = True, owner_min_rep_setting = owner_min_rep_setting, + min_rep_setting = min_rep_setting, owner_low_rep_error_message = owner_low_rep_error_message, - general_error_message = general_error_message + general_error_message = general_error_message, + blocked_error_message = blocked_error_message, + suspended_error_message = suspended_error_message ) @@ -2846,6 +2860,10 @@ def send_instant_notifications_about_activity_in_post( ) #send email for all recipients for user in recipients: + + if user.is_blocked(): + continue + reply_address, alt_reply_address = get_reply_to_addresses(user, post) subject_line, body_text = format_instant_notification_email( diff --git a/askbot/skins/common/media/js/utils.js b/askbot/skins/common/media/js/utils.js index d04a3cdb..81aff7c3 100644 --- a/askbot/skins/common/media/js/utils.js +++ b/askbot/skins/common/media/js/utils.js @@ -1,6 +1,10 @@ //var $, scriptUrl, askbotSkin +/** + * attention - this function needs to be retired + * as it cannot accurately give url to the media file + */ var mediaUrl = function(resource){ - return askbot['settings']['static_url'] + askbotSkin + '/' + resource; + return askbot['settings']['static_url'] + 'default' + '/' + resource; }; var cleanUrl = function(url){ diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less index fd2d5b5a..4e272eca 100644 --- a/askbot/skins/default/media/style/style.less +++ b/askbot/skins/default/media/style/style.less @@ -675,7 +675,7 @@ body.anon { font-size:16px; border-bottom:#cccccc 1px solid; font-size:13px; - + strong{ float:right; padding-right:10px; @@ -683,16 +683,23 @@ body.anon { } .questions-related { word-wrap: break-word; - + p { line-height: 20px; - padding: 4px 0px 4px 0px; + padding: 4px 0px 9px 0px; font-size: 16px; font-weight:normal; border-bottom:#cccccc 1px solid; } - a{ + p:first-child { + margin-top: -4px; + } + p:last-child { + border: none; + } + a { font-size:13px; + line-height: 1.3; } } /* tips and markdown help are widgets for ask template */ @@ -1733,9 +1740,6 @@ ul#related-tags li { #fmanswer_button{ margin:8px 0px; } - #fmanswer_button.answer-own-question { - width: 150px; - } .question-img-favorite:hover { background: url(../images/vote-favorite-on.png) } @@ -1872,9 +1876,9 @@ ul#related-tags li { margin: -3px 0px 0px -2px; } .content { - margin-bottom: 7px; + margin-bottom: 7px; } - + .comment-votes { float: left; width: 37px; diff --git a/askbot/skins/default/templates/question/content.html b/askbot/skins/default/templates/question/content.html index 906b1953..f01c68e0 100644 --- a/askbot/skins/default/templates/question/content.html +++ b/askbot/skins/default/templates/question/content.html @@ -31,6 +31,11 @@ {# ==== START: question/new_answer_form.html ==== #} {% include "question/new_answer_form.html" %} {# ==== END: question/new_answer_form.html ==== #} -{% if request.user == question.author %}{# this is outside the form on purpose #} - <input type="button" class="submit after-editor answer-own-question" id="fmanswer_button" value="{% trans %}Answer Your Own Question{% endtrans %}"/> -{%endif%} +{% if question.closed == False and request.user == question.author %}{# this is outside the form on purpose #} +<input + type="button" + class="submit after-editor answer-own-question" + id="fmanswer_button" + value="{% trans %}Answer Your Own Question{% endtrans %}" +/> +{% endif %} diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html index 3a29579d..73e209bb 100644 --- a/askbot/skins/default/templates/question/javascript.html +++ b/askbot/skins/default/templates/question/javascript.html @@ -1,32 +1,30 @@ -{% if not thread.closed %} - <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> - <script type='text/javascript'> - {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} - var codeFriendlyMarkdown = true; - {% else %} - var codeFriendlyMarkdown = false; - {% endif %} - var maxCommentLength = {{settings.MAX_COMMENT_LENGTH}}; - askbot['urls']['postComments'] = '{% url post_comments %}'; - askbot['urls']['editComment'] = '{% url edit_comment %}'; - askbot['urls']['deleteComment'] = '{% url delete_comment %}'; - askbot['urls']['getComment'] = '{% url get_comment %}'; - askbot['urls']['question_url_template'] = scriptUrl + '{{ 'question/'|transurl }}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #} - askbot['urls']['vote_url_template'] = scriptUrl + '{{ 'questions/'|transurl }}{{ "{{QuestionID}}/" }}{{ 'vote/'|transurl }}'; - askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; - askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}'; - askbot['urls']['upvote_comment'] = '{% url upvote_comment %}'; - askbot['urls']['delete_post'] = '{% url delete_post %}'; - askbot['messages']['addComment'] = '{% trans %}post a comment{% endtrans %}'; - {% if settings.SAVE_COMMENT_ON_ENTER %} - askbot['settings']['saveCommentOnEnter'] = true; - {% else %} - askbot['settings']['saveCommentOnEnter'] = false; - {% endif %} - </script> - <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> -{% endif %} +<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> +<script type='text/javascript'> + {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} + var codeFriendlyMarkdown = true; + {% else %} + var codeFriendlyMarkdown = false; + {% endif %} + var maxCommentLength = {{settings.MAX_COMMENT_LENGTH}}; + askbot['urls']['postComments'] = '{% url post_comments %}'; + askbot['urls']['editComment'] = '{% url edit_comment %}'; + askbot['urls']['deleteComment'] = '{% url delete_comment %}'; + askbot['urls']['getComment'] = '{% url get_comment %}'; + askbot['urls']['question_url_template'] = scriptUrl + '{{ 'question/'|transurl }}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #} + askbot['urls']['vote_url_template'] = scriptUrl + '{{ 'questions/'|transurl }}{{ "{{QuestionID}}/" }}{{ 'vote/'|transurl }}'; + askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; + askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}'; + askbot['urls']['upvote_comment'] = '{% url upvote_comment %}'; + askbot['urls']['delete_post'] = '{% url delete_post %}'; + askbot['messages']['addComment'] = '{% trans %}post a comment{% endtrans %}'; + {% if settings.SAVE_COMMENT_ON_ENTER %} + askbot['settings']['saveCommentOnEnter'] = true; + {% else %} + askbot['settings']['saveCommentOnEnter'] = false; + {% endif %} +</script> +<script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> +<script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script> <script type='text/javascript' src='{{"/js/post.js"|media}}'></script> <script type="text/javascript"> diff --git a/askbot/skins/default/templates/revisions.html b/askbot/skins/default/templates/revisions.html index aa1996a9..a0531b80 100644 --- a/askbot/skins/default/templates/revisions.html +++ b/askbot/skins/default/templates/revisions.html @@ -79,8 +79,7 @@ $("#nav_questions").attr('className',"on"); $('div.revision div[id^=rev-header-]').bind('click', function(){ var revId = this.id.substr(11); - toggleRev(revId); - + toggleRev(revId); }); lanai.highlightSyntax(); }); @@ -88,13 +87,13 @@ function toggleRev(id) { var arrow = $("#rev-arrow-" + id); var visible = arrow.attr("src").indexOf("hide") > -1; - var path = mediaUrl( - "media/images/expander-arrow-" + - (visible ? "show" : "hide") + - ".gif" + - "?v={{settings.MEDIA_RESOURCE_REVISION}}" - ); - arrow.attr("src", path); + if (visible) { + var image_path = '{{ "/images/expander-arrow-show.gif"|media }}'; + } else { + var image_path = '{{ "/images/expander-arrow-hide.gif"|media }}'; + } + image_path = image_path + "?v={{settings.MEDIA_RESOURCE_REVISION}}"; + arrow.attr("src", image_path); $("#rev-body-" + id).slideToggle("fast"); } </script> diff --git a/askbot/tests/permission_assertion_tests.py b/askbot/tests/permission_assertion_tests.py index 2f746ef9..8061bdb8 100644 --- a/askbot/tests/permission_assertion_tests.py +++ b/askbot/tests/permission_assertion_tests.py @@ -447,9 +447,9 @@ class ReopenQuestionPermissionAssertionTests(utils.AskbotTestCase): ) - def test_high_rep_nonowner_cannot_reopen(self): + def test_high_rep_nonowner_can_reopen(self): self.other_user.reputation = 1000000 - self.assert_cannot_reopen(user = self.other_user) + self.assert_can_reopen(user = self.other_user) def test_low_rep_admin_can_reopen(self): self.other_user.set_admin_status() @@ -482,7 +482,7 @@ class ReopenQuestionPermissionAssertionTests(utils.AskbotTestCase): self.assert_cannot_reopen(user = self.other_user) class EditQuestionPermissionAssertionTests(utils.AskbotTestCase): - + def setUp(self): self.create_user() self.create_user(username = 'other_user') |