Skip to content
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

Merged
merged 4 commits into from
Nov 8, 2023

Conversation

guy-har
Copy link
Contributor

@guy-har guy-har commented Oct 31, 2023

No description provided.

@guy-har guy-har requested a review from nopcoder October 31, 2023 07:53
@@ -3941,6 +3938,15 @@ func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, bod
})
}

func getCommitter(user *model.User) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can we make it a method on the model
  2. 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.
  3. 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. changing
  2. 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?
  3. Even if that is the case, will we prefer the friendly name that is editable to the username?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Changed PTAL

@guy-har guy-har requested a review from nopcoder October 31, 2023 08:27
@guy-har guy-har linked an issue Oct 31, 2023 that may be closed by this pull request
@guy-har guy-har added the include-changelog PR description should be included in next release changelog label Oct 31, 2023
@guy-har guy-har changed the title change committer value from userid to email Change 'committer' field from UserID to Email, when Email is available Oct 31, 2023
Comment on lines 126 to 127
if u.Email != nil {
return *u.Email
Copy link
Contributor

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?

@guy-har guy-har requested a review from nopcoder October 31, 2023 08:45
Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@guy-har guy-har merged commit f746a5b into master Nov 8, 2023
29 checks passed
@guy-har guy-har deleted the fix/committer-value branch November 8, 2023 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Committer field value
2 participants