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:
parent
5ac10e2e79
commit
65a389c3ac
|
@ -397,7 +397,7 @@ class Guardian
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_bulk_invite_to_forum?(user)
|
def can_bulk_invite_to_forum?(user)
|
||||||
user.admin? && !SiteSetting.enable_discourse_connect
|
user.admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_resend_all_invites?(user)
|
def can_resend_all_invites?(user)
|
||||||
|
|
|
@ -904,6 +904,16 @@ describe InvitesController do
|
||||||
expect(Jobs::BulkInvite.jobs.size).to eq(1)
|
expect(Jobs::BulkInvite.jobs.size).to eq(1)
|
||||||
end
|
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
|
it 'sends limited invites at a time' do
|
||||||
SiteSetting.max_bulk_invites = 3
|
SiteSetting.max_bulk_invites = 3
|
||||||
sign_in(admin)
|
sign_in(admin)
|
||||||
|
|
Loading…
Reference in New Issue