Make notification_email like commit_email
What does this MR do?
When there is no database value for User#commit_email
or User#notification_email
,
the primary email is used instead. While the behavior is the same, the code is different:
- Non-database:
User#commit_email
is not set in the database until set by the user. Thecommit_email
getter method is overridden to return the primary email if there is no database value. - Database:
User#notification_email
is set in the database via a callback when blank.
These attributes are both intended to capture user input, so as a general rule we should not be setting database values without user input. Also, these attributes are intended to have the same behavior, so should be coded the same.
This MR modifies the User#notification_email
attribute to use the non-database approach. The intent
of this change is to help standardize the behavior of secondary email attributes, as part of a broader refactoring.
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Contributes to https://gitlab.com/groups/gitlab-org/-/epics/6564
Edited by Dan Jensen