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

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.

diff --git a/lib/guardian.rb b/lib/guardian.rb
index f623f45..a4af71e 100644
--- a/lib/guardian.rb
+++ b/lib/guardian.rb
@@ -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)
diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb
index 8528939..eea1a2d 100644
--- a/spec/requests/invites_controller_spec.rb
+++ b/spec/requests/invites_controller_spec.rb
@@ -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)

GitHub sha: 65a389c3ac0f04daa7df2a731f471538f2a493c4

This commit appears in #14862 which was approved by udan11. It was merged by davidtaylorhq.