Browse Source

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
for-closed-social
Lanre Adelowo 6 years ago
committed by Lauris BH
parent
commit
4bf0cae1f5
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      routers/api/v1/user/user.go

+ 1
- 1
routers/api/v1/user/user.go 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
}
}

Loading…
Cancel
Save