mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
FIX: Sites with SSO that required approval were not creating reviewables
This commit is contained in:
parent
eae22548de
commit
cab83596ec
@ -84,6 +84,9 @@ class DiscourseSingleSignOn < SingleSignOn
|
||||
user.user_avatar.save! if user.user_avatar
|
||||
user.save!
|
||||
|
||||
# The user might require approval
|
||||
user.create_reviewable
|
||||
|
||||
if bio && (user.user_profile.bio_raw.blank? || SiteSetting.sso_overrides_bio)
|
||||
user.user_profile.bio_raw = bio
|
||||
user.user_profile.save!
|
||||
|
@ -102,6 +102,31 @@ describe DiscourseSingleSignOn do
|
||||
expect(user.name).to eq("Bob O'Bob")
|
||||
end
|
||||
|
||||
context "reviewables" do
|
||||
let(:sso) do
|
||||
DiscourseSingleSignOn.new.tap do |sso|
|
||||
sso.username = "staged"
|
||||
sso.name = "Bob O'Bob"
|
||||
sso.email = "bob@obob.com"
|
||||
sso.external_id = "B"
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't create reviewables if we aren't approving users" do
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
reviewable = ReviewableUser.find_by(target: user)
|
||||
expect(reviewable).to be_blank
|
||||
end
|
||||
|
||||
it "creates reviewables if needed" do
|
||||
SiteSetting.must_approve_users = true
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
reviewable = ReviewableUser.find_by(target: user)
|
||||
expect(reviewable).to be_present
|
||||
expect(reviewable).to be_pending
|
||||
end
|
||||
end
|
||||
|
||||
it "can set admin and moderator" do
|
||||
admin_group = Group[:admins]
|
||||
mod_group = Group[:moderators]
|
||||
|
Loading…
Reference in New Issue
Block a user