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