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