summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2018-07-25 13:11:22 +0100
committerLauris BH <lauris@nix.lv>2018-07-25 15:11:22 +0300
commit4bf0cae1f59ace607875850227856fc3cc127464 (patch)
treeebf2c5386aa4e6d2939128ad649e35c49694548b
parentd0fef4395f2537ecea3cc22230dd4bf556945fa7 (diff)
downloadgitea-4bf0cae1f59ace607875850227856fc3cc127464.tar.gz
gitea-4bf0cae1f59ace607875850227856fc3cc127464.zip
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
-rw-r--r--routers/api/v1/user/user.go2
1 files changed, 1 insertions, 1 deletions
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
}
}