Skip to content

Modifying filter attribute in audit events only shows id number

Summary

When hitting back, the filter option changes from a name to its id number.

Steps to reproduce

Make a selection for any filter option, and then hit backspace

bug

What is the expected correct behavior?

Show the string, so that the dropdown gives the right options instead of saying no results.

Screen_Shot_2021-07-01_at_12.31.13_PM

Implementation

backend - 3️⃣ or more

  • Update ee/app/controllers/admin/audit_logs_controller.rb to accept & find by username instead of entity_id for users.
  • Update ee/app/controllers/concerns/audit_events/audit_logs_params.rb to accept usernames for user entities.
  • Update ee/app/finders/audit_log_finder.rb to accept & find by usernames for users
  • Update ee/app/controllers/projects/audit_events_controller.rb to filter using the current user's username instead of id.
  • Update ee/app/controllers/groups/audit_events_controller.rb to filter using the current user's username instead of id.
  • Update specs

frontend - 5️⃣

  • Update ee/app/assets/javascripts/audit_events/components/tokens/user_token.vue to get the user by username.
  • Update ee/app/assets/javascripts/audit_events/components/tokens/member_token.vue to get the member by username.
  • Update ee/app/assets/javascripts/audit_events/components/tokens/shared/audit_filter_token.vue:
    • Fetch suggestions only when not is_numeric and not a valid username.
    • GlFilteredSearchSuggestion value should be username and not id for users and members.
  • Update specs
Edited by Jiaan Louw