From 4bf0cae1f59ace607875850227856fc3cc127464 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Wed, 25 Jul 2018 13:11:22 +0100 Subject: [PATCH] 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 --- routers/api/v1/user/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index 0453a455f4..49e5f34136 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -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 } }