diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2018-07-25 13:11:22 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-07-25 15:11:22 +0300 |
commit | 4bf0cae1f59ace607875850227856fc3cc127464 (patch) | |
tree | ebf2c5386aa4e6d2939128ad649e35c49694548b | |
parent | d0fef4395f2537ecea3cc22230dd4bf556945fa7 (diff) | |
download | gitea-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.go | 2 |
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 } } |