Skip to content

Commit 4bf0cae

Browse files
adelowolafriks
authored andcommitted
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
1 parent d0fef43 commit 4bf0cae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/api/v1/user/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func Search(ctx *context.APIContext) {
6060
AvatarURL: users[i].AvatarLink(),
6161
FullName: markup.Sanitize(users[i].FullName),
6262
}
63-
if ctx.IsSigned {
63+
if ctx.IsSigned && (!users[i].KeepEmailPrivate || ctx.User.IsAdmin) {
6464
results[i].Email = users[i].Email
6565
}
6666
}

0 commit comments

Comments
 (0)