-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change 'committer' field from UserID to Email, when Email is available #6912
Conversation
pkg/api/controller.go
Outdated
@@ -3941,6 +3938,15 @@ func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, bod | |||
}) | |||
} | |||
|
|||
func getCommitter(user *model.User) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can we make it a method on the model
- We should have email verification before user's creation - we should assume that email is valid. You can keep the null and empty check before return the value.
- Need to verify ldap integration as which value we keep for username, not sure email is populated in this case and maybe we need too apply the friendly name in this case. Alternative, open a specific issue for external auth with ldap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- changing
- I know, but still we are getting the email from an external service, thought it's better to stay safe than have unknown strings in the committer, @nopcoder WDYT?
- Even if that is the case, will we prefer the friendly name that is editable to the username?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is that if the case the user's email is not an actual email, have a problem in some place else and we don't want to move this problem (and verify it) every time we use information from user model.
Prefer the username.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Changed PTAL
pkg/auth/model/model.go
Outdated
if u.Email != nil { | ||
return *u.Email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also verify the value is not empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.