This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/lib/jobs/close_topic.rb
T

16 lines
384 B
Ruby

module Jobs
class CloseTopic < Jobs::Base
def execute(args)
topic = Topic.find(args[:topic_id])
if topic and topic.auto_close_at and !topic.closed? and !topic.deleted_at
closer = User.find(args[:user_id])
if Guardian.new(closer).can_moderate?(topic)
topic.update_status('autoclosed', true, closer)
end
end
end
end
end