diff options
-rw-r--r-- | askbot/models/__init__.py | 18 | ||||
-rw-r--r-- | askbot/tests/permission_assertion_tests.py | 6 |
2 files changed, 19 insertions, 5 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 12dd97fd..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 ) 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') |