FIX: do not send welcome message to staged users
This commit is contained in:
parent
4763d6c9d7
commit
3c5fbd3ce1
|
@ -119,7 +119,7 @@ after_initialize do
|
||||||
end
|
end
|
||||||
|
|
||||||
self.add_model_callback(User, :after_commit, on: :create) do
|
self.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.staged
|
||||||
self.enqueue_bot_welcome_post
|
self.enqueue_bot_welcome_post
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,6 +43,17 @@ describe "Discobot welcome post" do
|
||||||
expect(Jobs::NarrativeInit.jobs.first["args"].first["user_id"]).to eq(User.last.id)
|
expect(Jobs::NarrativeInit.jobs.first["args"].first["user_id"]).to eq(User.last.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
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 }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue