A platform for community discussion. Free, open, simple.
FIX: do not send welcome message to staged users
Penar Musaraj3c5fbd3ce1f0
diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rbindex b51e3181473..e44a8ae1d25 100644--- a/plugins/discourse-narrative-bot/plugin.rb+++ b/plugins/discourse-narrative-bot/plugin.rb@@ -119,7 +119,7 @@ after_initialize doendself.add_model_callback(User, :after_commit, on: :create) do- if SiteSetting.discourse_narrative_bot_welcome_post_delay == 0+ if SiteSetting.discourse_narrative_bot_welcome_post_delay == 0 && !self.stagedself.enqueue_bot_welcome_postendenddiff --git a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rbindex f9087b74597..48113a40b3e 100644--- a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb+++ b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb@@ -43,6 +43,17 @@ describe "Discobot welcome post" doexpect(Jobs::NarrativeInit.jobs.first["args"].first["user_id"]).to eq(User.last.id)endend+ end++ context 'when user is staged' do+ let(:staged_user) { Fabricate(:user, staged: true) }++ before do+ SiteSetting.discourse_narrative_bot_welcome_post_type = 'welcome_message'+ end+ it 'should not send welcome message' do+ expect { staged_user }.to_not change { Jobs::SendDefaultWelcomeMessage.jobs.count }+ endendend