mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 22:31:19 +08:00
FIX: Allow advanced tutorial to be started if badges are disabled.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user