From 084eacb5d42f1ed2520442a4bbc91bb70c9759e1 Mon Sep 17 00:00:00 2001
From: techknowlogick <hello@techknowlogick.com>
Date: Tue, 5 Sep 2023 13:56:21 -0400
Subject: [PATCH] fetch emails of currently displayed user on admin page
 (#26918)

Currently, this fetches the emails from the user viewing the page. This
PR changes it to show the emails from the user whose page it is.
---
 routers/web/admin/users.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go
index 61df49b85b..c83d652c3d 100644
--- a/routers/web/admin/users.go
+++ b/routers/web/admin/users.go
@@ -281,7 +281,7 @@ func ViewUser(ctx *context.Context) {
 	ctx.Data["Repos"] = repos
 	ctx.Data["ReposTotal"] = int(count)
 
-	emails, err := user_model.GetEmailAddresses(ctx.Doer.ID)
+	emails, err := user_model.GetEmailAddresses(u.ID)
 	if err != nil {
 		ctx.ServerError("GetEmailAddresses", err)
 		return