discourse/app/jobs/regular/delete_topic.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
464 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-05-11 12:52:15 -04:00
module Jobs
class DeleteTopic < ::Jobs::TopicTimerBase
def execute_timer_action(topic_timer, topic)
if Guardian.new(topic_timer.user).can_delete?(topic)
2017-05-11 12:52:15 -04:00
first_post = topic.ordered_posts.first
PostDestroyer.new(
topic_timer.user, first_post, context: I18n.t("topic_statuses.auto_deleted_by_timer")
).destroy
topic_timer.trash!(Discourse.system_user)
2017-05-11 12:52:15 -04:00
end
end
end
end