Commit ece9a17c authored by Mark Chao's avatar Mark Chao

Merge branch 'vij-fix-update-highest-role' into 'master'

Update a user highest role when removed from group

See merge request gitlab-org/gitlab!65164
parents 6a84e4f9 e443da4b
......@@ -439,7 +439,7 @@ class Member < ApplicationRecord
def update_highest_role?
return unless user_id.present?
previous_changes[:access_level].present?
previous_changes[:access_level].present? || destroyed?
end
def update_highest_role_attribute
......
......@@ -706,7 +706,8 @@ RSpec.describe Member do
end
context 'when after_commit :update_highest_role' do
let!(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:user_id) { user.id }
where(:member_type, :source_type) do
......@@ -741,7 +742,7 @@ RSpec.describe Member do
end
describe 'destroy member' do
subject { member.destroy! }
subject { member.reload.destroy! }
include_examples 'update highest role with exclusive lease'
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment