2013-05-07 14:25:41 -04:00
|
|
|
module Jobs
|
|
|
|
class CloseTopic < Jobs::Base
|
|
|
|
|
|
|
|
def execute(args)
|
2013-07-05 01:21:04 -04:00
|
|
|
topic = Topic.where(id: args[:topic_id]).first
|
2013-05-15 15:19:41 -04:00
|
|
|
if topic and topic.auto_close_at and !topic.closed? and !topic.deleted_at
|
2013-07-05 01:21:04 -04:00
|
|
|
closer = User.where(id: args[:user_id]).first
|
2013-05-07 14:25:41 -04:00
|
|
|
if Guardian.new(closer).can_moderate?(topic)
|
|
|
|
topic.update_status('autoclosed', true, closer)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|