From ce383b58186ef2940b400265719eade4c8e555c2 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 4 Jun 2023 11:36:07 +0200 Subject: [PATCH] refactor: mv ctx to a later point --- handlers/manage-user.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/handlers/manage-user.go b/handlers/manage-user.go index a6637d9..c23eaa9 100644 --- a/handlers/manage-user.go +++ b/handlers/manage-user.go @@ -279,11 +279,6 @@ func ViewUser() echo.HandlerFunc { ) } - ctx, ok := c.Get("sloggerCtx").(context.Context) - if !ok { - ctx = context.WithValue(context.Background(), moduser.CtxKey{}, slogger) - } - if !u.IsAdmin { c.Logger().Debug("this is a restricted endpoint") @@ -295,6 +290,11 @@ func ViewUser() echo.HandlerFunc { ) } + ctx, ok := c.Get("sloggerCtx").(context.Context) + if !ok { + ctx = context.WithValue(context.Background(), moduser.CtxKey{}, slogger) + } + p := page{ AppName: setting.AppName(), AppVer: appver,