Skip to content

Add created_by relationship to User model

Ian Anderson requested to merge ia-refactor-user-created_by into master

What does this MR do and why?

Related to: https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/772

This MR refactors the user model by implementing a belongs_to relationship for created_by and removing the created_by method. This was found during an MR review which required mocking created_by in tests to allow them to pass. By implementing this we are also able to remove the mocks that were used in the specs.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Ian Anderson

Merge request reports