mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
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
2 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,10 @@ module Jobs
|
|||
def execute(args)
|
||||
if topic = Topic.find_by(id: args[:topic_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)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -114,6 +114,7 @@ class Guardian
|
|||
alias :can_move_posts? :can_moderate?
|
||||
alias :can_see_flags? :can_moderate?
|
||||
alias :can_send_activation_email? :can_moderate?
|
||||
alias :can_close? :can_moderate?
|
||||
|
||||
def can_grant_badges?(_user)
|
||||
SiteSetting.enable_badges && is_staff?
|
||||
|
|
Loading…
Reference in a new issue