Audit Event show unknown when auto approve after removing user cap

Summary

Bug found in gitlab.com. Customer reported (internal), that when removing group user cap and auto approve all users in pending status. The Group Audit events show target as unknown for all approved members with message Changed the membership state to active

Steps to reproduce

  1. Go to group in gitlab.com
  2. Add user cap
  3. Invite more user than user cap
  4. Remove user cap, and Approve users on pop up dialogue.
  5. Go to audit events and see target as unknown

Screenshot_2024-06-05_at_12.04.25_PM

Example Project

https://gitlab.com/groups/gerardo_premium_group/-/audit_events

What is the current bug behavior?

Target shows unknown in Audit event

What is the expected correct behavior?

Target shows User that was approved in Audit event

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by 🤖 GitLab Bot 🤖