mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Allow advanced tutorial to be started if badges are disabled.
This commit is contained in:
parent
9fac5e28a5
commit
ee23ce5acc
2 changed files with 8 additions and 1 deletions
|
@ -96,7 +96,7 @@ module DiscourseNarrativeBot
|
||||||
}
|
}
|
||||||
|
|
||||||
def self.can_start?(user)
|
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?
|
user.badges.where(name: DiscourseNarrativeBot::NewUserNarrative::BADGE_NAME).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,13 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
||||||
expect(described_class.can_start?(user)).to eq(true)
|
expect(described_class.can_start?(user)).to eq(true)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
describe '#notify_timeout' do
|
describe '#notify_timeout' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue