Skip to content

Commit

Permalink
Skip Discobot flag tutorial if allow_flagging_staff is disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxworld committed Sep 7, 2018
1 parent 3dea48f commit c1c9637
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Expand Up @@ -95,6 +95,7 @@ class NewUserNarrative < Base
},

tutorial_flag: {
prerequisite: Proc.new { SiteSetting.allow_flagging_staff },
next_state: :tutorial_search,
next_instructions: Proc.new { I18n.t("#{I18N_KEY}.search.instructions", base_uri: Discourse.base_uri) },
flag: {
Expand Down
Expand Up @@ -401,6 +401,22 @@

expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_flag)
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

Expand Down

1 comment on commit c1c9637

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/interacting-with-discobot/96574/6

Please sign in to comment.