2019-05-03 08:17:27 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-24 17:27:43 +02:00
|
|
|
module Jobs
|
2019-10-02 14:01:53 +10:00
|
|
|
class NotifyCategoryChange < ::Jobs::Base
|
2018-05-24 17:27:43 +02:00
|
|
|
def execute(args)
|
|
|
|
post = Post.find_by(id: args[:post_id])
|
|
|
|
|
2019-04-05 15:06:38 +02:00
|
|
|
if post&.topic&.visible?
|
2018-05-24 17:27:43 +02:00
|
|
|
post_alerter = PostAlerter.new
|
2020-01-29 11:03:47 +11:00
|
|
|
post_alerter.notify_post_users(
|
|
|
|
post,
|
|
|
|
User.where(id: args[:notified_user_ids]),
|
|
|
|
include_tag_watchers: false,
|
|
|
|
)
|
2018-05-24 17:27:43 +02:00
|
|
|
post_alerter.notify_first_post_watchers(post, post_alerter.category_watchers(post.topic))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|