UX: Let users know they disabled discobot and they can't interact with it. (#12534)

Discobot will reply to users they need to enable onboarding tips to interact with them when issued a command.
This commit is contained in:
Roman Rizzi
2021-03-29 14:21:30 -03:00
committed by GitHub
parent f0b2e77abb
commit 87b5d16c10
5 changed files with 29 additions and 3 deletions

View File

@ -19,6 +19,8 @@ describe DiscourseNarrativeBot::TrackSelector do
before do
stub_request(:get, "http://api.forismatic.com/api/1.0/?format=json&lang=en&method=getQuote").
to_return(status: 200, body: "{\"quoteText\":\"Be Like Water\",\"quoteAuthor\":\"Bruce Lee\"}")
SiteSetting.discourse_narrative_bot_enabled = true
end
let(:help_message) do
@ -466,6 +468,16 @@ describe DiscourseNarrativeBot::TrackSelector do
expect(new_post.raw).to eq(random_mention_reply)
end
it 'tells the user to enable the onboarding tips first' do
user.user_option.update!(skip_new_user_tips: true)
post.update!(raw: 'Show me what you can do @discobot')
described_class.new(:reply, user, post_id: post.id).select
new_post = Post.last
expect(new_post.raw).to eq(I18n.t('discourse_narrative_bot.track_selector.random_mention.discobot_disabled'))
end
it "should be case insensitive towards discobot's username" do
discobot_user.update!(username: 'DisCoBot')

View File

@ -167,4 +167,12 @@ describe User do
expect(DiscourseNarrativeBot::Store.get(user.id)).to eq(nil)
end
end
describe '#manually_disabled_discobot?' do
it 'returns true if the user manually disabled new user tips' do
user.user_option.skip_new_user_tips = true
expect(user.manually_disabled_discobot?).to eq(true)
end
end
end