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