Change all occurrences of ApplicationHelper#avatar_icon to use a User object where possible
What does this MR do?
As proposed over here, this
- Removes ApplicationHelper#avatar_icon and
- introduces more specific
#avatar_icon_for_userand#avatar_icon_for_email. - Change to use
#avatar_icon_for_userover_for_emailwhere possible.
While the explicit #avatar_icon_for_user and #avatar_icon_for_email makes it less convenient to use than the generic one, it also makes it harder to introduce unnecessary database calls (or at least, it's easier to spot them).
Additionally, it adds eager loading for authors in corresponding finders for Note and Issue types.
Are there points in the code the reviewer needs to double check?
I'm not too sure about the added eager loading for authors as those finders are quite generic (see comment below).
Why was this MR needed?
We want to make it harder for callers of #avatar_icon to run into N+1 problems and unnecessary queries to find a user when given an email address.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered -
End-to-end tests pass ( package-qamanual pipeline job)
What are the relevant issue numbers?
Closes #42800 (closed)
Edited by Yorick Peterse