Skip to content

Commit

Permalink
Respect email privacy option in user search via API (#4512)
Browse files Browse the repository at this point in the history
* respect user's email privacy option

* make email visible to admin irrespective of privacy option
  • Loading branch information
adelowo authored and lafriks committed Jul 25, 2018
1 parent d0fef43 commit 4bf0cae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/api/v1/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 4bf0cae

Please sign in to comment.