mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
FIX: Notify mailing list subscribers on category change (#28811)
cf. https://meta.discourse.org/t/email-notifications-dont-get-sent-on-category-change-for-mailing-list-mode-users/308096
This commit is contained in:
parent
79d2eb5beb
commit
65a1e149ad
|
@ -13,6 +13,7 @@ module Jobs
|
|||
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
|
||||
|
|
|
@ -19,4 +19,18 @@ RSpec.describe ::Jobs::NotifyCategoryChange do
|
|||
Notification.count
|
||||
}
|
||||
end
|
||||
|
||||
context "when mailing list mode is enabled" do
|
||||
before { SiteSetting.disable_mailing_list_mode = false }
|
||||
before { regular_user.user_option.update(mailing_list_mode: true, mailing_list_mode_frequency: 1) }
|
||||
before { Jobs.run_immediately! }
|
||||
|
||||
it "notifies mailing list subscribers" do
|
||||
post.topic.update!(category: category)
|
||||
|
||||
expected_args = { "post_id" => post.id, "current_site_id" => "default" }
|
||||
Jobs::NotifyMailingListSubscribers.any_instance.expects(:execute).with(expected_args).once
|
||||
described_class.new.execute(post_id: post.id, notified_user_ids: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user