DEV: Modifier for Chat::Mailer to skip summary email for users (#26011)

This commit is contained in:
Mark VanLandingham
2024-03-04 09:21:02 -06:00
committed by GitHub
parent f7d7092a7a
commit 04b0f40db8
2 changed files with 25 additions and 0 deletions
@@ -235,6 +235,26 @@ describe Chat::Mailer do
assert_only_queued_once
end
context "with chat_mailer_send_summary_to_user modifier" do
let(:modifier_block) { Proc.new { |_| false } }
it "skips when modifier evaluates to false" do
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
plugin_instance = Plugin::Instance.new
plugin_instance.register_modifier(:chat_mailer_send_summary_to_user, &modifier_block)
described_class.send_unread_mentions_summary
assert_summary_skipped
ensure
DiscoursePluginRegistry.unregister_modifier(
plugin_instance,
:chat_mailer_send_summary_to_user,
&modifier_block
)
end
end
describe "update the user membership after we send the email" do
before { Jobs.run_immediately! }