FIX: Allow bulk invites to be used with DiscourseConnect (#14862)

Support for invites alongside DiscourseConnect was added in 355d51af. This commit fixes the guardian method so that the bulk invite button functionality also works.
This commit is contained in:
David Taylor 2021-11-09 17:43:23 +00:00 committed by GitHub
parent 5ac10e2e79
commit 65a389c3ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -397,7 +397,7 @@ class Guardian
end
def can_bulk_invite_to_forum?(user)
user.admin? && !SiteSetting.enable_discourse_connect
user.admin?
end
def can_resend_all_invites?(user)

View File

@ -904,6 +904,16 @@ describe InvitesController do
expect(Jobs::BulkInvite.jobs.size).to eq(1)
end
it 'allows admin to bulk invite when DiscourseConnect enabled' do
SiteSetting.discourse_connect_url = "https://example.com"
SiteSetting.enable_discourse_connect = true
sign_in(admin)
post '/invites/upload_csv.json', params: { file: file, name: 'discourse.csv' }
expect(response.status).to eq(200)
expect(Jobs::BulkInvite.jobs.size).to eq(1)
end
it 'sends limited invites at a time' do
SiteSetting.max_bulk_invites = 3
sign_in(admin)