From 51835d90ae185f5b44098345c183bc0f4a155bd6 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Wed, 25 Jul 2018 12:02:43 +0100 Subject: [PATCH 1/2] respect user's email 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 0453a455f4de8..d60b57a16ae1b 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 { results[i].Email = users[i].Email } } From 0faec6831f973e6a8f199f5b5a1e5153c2cd5e74 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Wed, 25 Jul 2018 12:23:53 +0100 Subject: [PATCH 2/2] 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 d60b57a16ae1b..49e5f3413644b 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 && !users[i].KeepEmailPrivate { + if ctx.IsSigned && (!users[i].KeepEmailPrivate || ctx.User.IsAdmin) { results[i].Email = users[i].Email } }