diff options
Diffstat (limited to 'app/models/members/group_member.rb')
-rw-r--r-- | app/models/members/group_member.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb index ab044b80133..a13133c90e9 100644 --- a/app/models/members/group_member.rb +++ b/app/models/members/group_member.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class GroupMember < Member + extend ::Gitlab::Utils::Override include FromUnion include CreatedAtFilterable @@ -49,6 +50,19 @@ class GroupMember < Member { group: group } end + override :refresh_member_authorized_projects + def refresh_member_authorized_projects + # Here, `destroyed_by_association` will be present if the + # GroupMember is being destroyed due to the `dependent: :destroy` + # callback on Group. In this case, there is no need to refresh the + # authorizations, because whenever a Group is being destroyed, + # its projects are also destroyed, so the removal of project_authorizations + # will happen behind the scenes via DB foreign keys anyway. + return if destroyed_by_association.present? + + super + end + private def access_level_inclusion |