FIX: Allow advanced tutorial to be started if badges are disabled.

This commit is contained in:
Guo Xiang Tan 2017-05-24 18:34:10 +08:00
parent 9fac5e28a5
commit ee23ce5acc
2 changed files with 8 additions and 1 deletions

View File

@ -96,7 +96,7 @@ module DiscourseNarrativeBot
}
def self.can_start?(user)
return true if user.staff?
return true if user.staff? || !SiteSetting.enable_badges
user.badges.where(name: DiscourseNarrativeBot::NewUserNarrative::BADGE_NAME).exists?
end

View File

@ -33,6 +33,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(described_class.can_start?(user)).to eq(true)
end
end
describe 'when badges are disabled' do
it 'should return true' do
SiteSetting.enable_badges = false
expect(described_class.can_start?(user)).to eq(true)
end
end
end
describe '#notify_timeout' do