Merge pull request #3303 from riking/patch-6
FIX: Don't fail topic auto-close if privledges are lost
This commit is contained in:
commit
23e8e1b6c1
|
@ -4,6 +4,10 @@ module Jobs
|
||||||
def execute(args)
|
def execute(args)
|
||||||
if topic = Topic.find_by(id: args[:topic_id])
|
if topic = Topic.find_by(id: args[:topic_id])
|
||||||
closer = User.find_by(id: args[:user_id])
|
closer = User.find_by(id: args[:user_id])
|
||||||
|
guardian = Guardian.new(closer)
|
||||||
|
unless guardian.can_close?(topic)
|
||||||
|
closer = Discourse.system_user
|
||||||
|
end
|
||||||
topic.auto_close(closer)
|
topic.auto_close(closer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,6 +114,7 @@ class Guardian
|
||||||
alias :can_move_posts? :can_moderate?
|
alias :can_move_posts? :can_moderate?
|
||||||
alias :can_see_flags? :can_moderate?
|
alias :can_see_flags? :can_moderate?
|
||||||
alias :can_send_activation_email? :can_moderate?
|
alias :can_send_activation_email? :can_moderate?
|
||||||
|
alias :can_close? :can_moderate?
|
||||||
|
|
||||||
def can_grant_badges?(_user)
|
def can_grant_badges?(_user)
|
||||||
SiteSetting.enable_badges && is_staff?
|
SiteSetting.enable_badges && is_staff?
|
||||||
|
|
Loading…
Reference in New Issue