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

Include login_name in adminCreateUser response #20283

Merged
merged 12 commits into from
Jul 15, 2022
Prev Previous commit
Next Next commit
Fix structure and comment
  • Loading branch information
Baekjun Kim committed Jul 14, 2022
commit ecdf8eab068a25f54cfc731d1c9d7285013a5140
7 changes: 1 addition & 6 deletions modules/convert/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ func toUser(user *user_model.User, signed, authed bool) *api.User {
StarredRepos: user.NumStars,
}

if authed {
result.LoginName = user.LoginName
} else {
result.LoginName = ""
}

result.Visibility = user.Visibility.String()

// hide primary email if API caller is anonymous or user keep email private
Expand All @@ -79,6 +73,7 @@ func toUser(user *user_model.User, signed, authed bool) *api.User {
// only site admin will get these information and possibly user himself
if authed {
result.IsAdmin = user.IsAdmin
result.LoginName = user.LoginName
result.LastLogin = user.LastLoginUnix.AsTime()
result.Language = user.Language
result.IsActive = user.IsActive
Expand Down
2 changes: 1 addition & 1 deletion modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type User struct {
ID int64 `json:"id"`
// the user's username
UserName string `json:"login"`
// the user's login name
// the user's authentication sign-in name. default: empty
LoginName string `json:"login_name"`
// the user's full name
FullName string `json:"full_name"`
Expand Down