0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-17 07:21:15 +01:00

Respect email privacy option in user search via API (#4512)

* respect user's email privacy option

* make email visible to admin irrespective of privacy option
This commit is contained in:
Lanre Adelowo 2018-07-25 13:11:22 +01:00 committed by Lauris BH
parent d0fef4395f
commit 4bf0cae1f5

View file

@ -60,7 +60,7 @@ func Search(ctx *context.APIContext) {
AvatarURL: users[i].AvatarLink(),
FullName: markup.Sanitize(users[i].FullName),
}
if ctx.IsSigned {
if ctx.IsSigned && (!users[i].KeepEmailPrivate || ctx.User.IsAdmin) {
results[i].Email = users[i].Email
}
}