1
0
Fork 0
forked from forgejo/forgejo

Add Location, Website and Biography to API (#15675)

This commit is contained in:
KN4CK3R 2021-05-01 11:05:55 +02:00 committed by GitHub
parent 5811e162ae
commit 67e10397af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 7 deletions

View file

@ -38,13 +38,16 @@ func ToUserWithAccessMode(user *models.User, accessMode models.AccessMode) *api.
// signed shall only be set if requester is logged in. authed shall only be set if user is site admin or user himself
func toUser(user *models.User, signed, authed bool) *api.User {
result := &api.User{
ID: user.ID,
UserName: user.Name,
FullName: markup.Sanitize(user.FullName),
Email: user.GetEmail(),
AvatarURL: user.AvatarLink(),
Created: user.CreatedUnix.AsTime(),
Restricted: user.IsRestricted,
ID: user.ID,
UserName: user.Name,
FullName: markup.Sanitize(user.FullName),
Email: user.GetEmail(),
AvatarURL: user.AvatarLink(),
Created: user.CreatedUnix.AsTime(),
Restricted: user.IsRestricted,
Location: user.Location,
Website: user.Website,
Description: user.Description,
}
// hide primary email if API caller is anonymous or user keep email private
if signed && (!user.KeepEmailPrivate || authed) {