mirror of
https://github.com/discourse/discourse.git
synced 2025-03-28 05:37:54 +08:00
Skip Discobot flag tutorial if allow_flagging_staff
is disabled.
https://meta.discourse.org/t/interacting-with-discobot/96574
This commit is contained in:
parent
3dea48f1d9
commit
c1c9637b39
@ -95,6 +95,7 @@ module DiscourseNarrativeBot
|
|||||||
},
|
},
|
||||||
|
|
||||||
tutorial_flag: {
|
tutorial_flag: {
|
||||||
|
prerequisite: Proc.new { SiteSetting.allow_flagging_staff },
|
||||||
next_state: :tutorial_search,
|
next_state: :tutorial_search,
|
||||||
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.search.instructions", base_uri: Discourse.base_uri) },
|
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.search.instructions", base_uri: Discourse.base_uri) },
|
||||||
flag: {
|
flag: {
|
||||||
|
@ -401,6 +401,22 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||||||
|
|
||||||
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_flag)
|
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_flag)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when allow_flagging_staff is false' do
|
||||||
|
it 'should go to the right state' do
|
||||||
|
SiteSetting.allow_flagging_staff = false
|
||||||
|
post.update!(raw: skip_trigger)
|
||||||
|
|
||||||
|
DiscourseNarrativeBot::TrackSelector.new(
|
||||||
|
:reply,
|
||||||
|
user,
|
||||||
|
post_id: post.id
|
||||||
|
).select
|
||||||
|
|
||||||
|
expect(narrative.get_data(user)[:state].to_sym)
|
||||||
|
.to eq(:tutorial_search)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user