@true_if_is_super_or_staff
def can_reopen_question(self, question):
- return self == question.author and self.reputation >= int(settings.REP_TO_REOPEN_OWN)
+ # Check whether the setting to Unify close and reopen permissions has been activated
+ if bool(settings.UNIFY_PERMISSIONS_TO_CLOSE_AND_REOPEN):
+ # If we unify close to reopen check whether the user has permissions to close.
+ # If he has -- he can reopen his question too.
+ can_reopen = (
+ self == question.author and self.reputation >= int(settings.REP_TO_CLOSE_OWN)
+ ) or self.reputation >= int(settings.REP_TO_CLOSE_OTHERS)
+ else:
+ # Check whether the user is the author and has the required permissions to reopen
+ can_reopen = self == question.author and self.reputation >= int(settings.REP_TO_REOPEN_OWN)
+ return can_reopen
@true_if_is_super_or_staff
def can_delete_post(self, post):
label = _("Minimum reputation to close own question"),\r
help_text = _("The minimum reputation an user must have to be allowed to close his own question.")))\r
\r
+UNIFY_PERMISSIONS_TO_CLOSE_AND_REOPEN = Setting('UNIFY_PERMISSIONS_TO_CLOSE_AND_REOPEN', True, MIN_REP_SET, dict(\r
+label = _("Unify close and reopen permissions"),\r
+help_text = _("If checked the same permissions as the ones to close question will be required to reopen it."),\r
+required=False))\r
+\r
REP_TO_REOPEN_OWN = Setting('REP_TO_REOPEN_OWN', 500, MIN_REP_SET, dict(\r
label = _("Minimum reputation to reopen own question"),\r
help_text = _("The minimum reputation an user must have to be allowed to reopen his own question.")))\r