mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
65a1e149ad
cf. https://meta.discourse.org/t/email-notifications-dont-get-sent-on-category-change-for-mailing-list-mode-users/308096
21 lines
584 B
Ruby
21 lines
584 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class NotifyCategoryChange < ::Jobs::Base
|
|
def execute(args)
|
|
post = Post.find_by(id: args[:post_id])
|
|
|
|
if post&.topic&.visible?
|
|
post_alerter = PostAlerter.new
|
|
post_alerter.notify_post_users(
|
|
post,
|
|
User.where(id: args[:notified_user_ids]),
|
|
include_tag_watchers: false,
|
|
)
|
|
post_alerter.notify_first_post_watchers(post, post_alerter.category_watchers(post.topic))
|
|
::Jobs.enqueue(:notify_mailing_list_subscribers, post_id: post.id)
|
|
end
|
|
end
|
|
end
|
|
end
|