FIX: Mark invited admins as 'approved' (#7459)

FIX: Mark invited admins as ‘approved’ (#7459)

This prevents invited admins appearing as no-op reviewables in the queue when invite_only or require_approval is enabled.

diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 8cd5a0f..0bdc7bb 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -503,6 +503,7 @@ class Admin::UsersController < Admin::AdminController
     end
 
     user.active = true
+    user.approved = true
     user.save!
     user.grant_admin!
     user.change_trust_level!(4)
diff --git a/spec/requests/admin/users_controller_spec.rb b/spec/requests/admin/users_controller_spec.rb
index 9ea3689..451cf27 100644
--- a/spec/requests/admin/users_controller_spec.rb
+++ b/spec/requests/admin/users_controller_spec.rb
@@ -796,6 +796,8 @@ RSpec.describe Admin::UsersController do
       expect(u.name).to eq("Bill")
       expect(u.username).to eq("bill22")
       expect(u.admin).to eq(true)
+      expect(u.active).to eq(true)
+      expect(u.approved).to eq(true)
     end
 
     it "doesn't send the email with send_email falsey" do

GitHub sha: 5edb5c8b

1 Like