mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: There are still jobs enqueued for CloseTopic
This commit is contained in:
20
app/jobs/regular/close_topic.rb
Normal file
20
app/jobs/regular/close_topic.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# This file is back temporarily to handle jobs that are enqueued
|
||||
# far in the future that haven't been migrated to the ToggleTopicClosed
|
||||
# job.
|
||||
|
||||
module Jobs
|
||||
class CloseTopic < Jobs::Base
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user