From 136d7492ffb9e105364c542ae3ec9dcf7c4816a0 Mon Sep 17 00:00:00 2001 From: Jakob <72307968+jakob30061@users.noreply.github.com> Date: Sun, 23 Apr 2023 03:32:40 +0200 Subject: [PATCH] Add missing badges in user profile for /projects and /packages (#24232) - Implement fix for user and organization page - Add necessary ctx.Data When switching tabs on `user profile page` the badges are shown for `/gitea_user?tab=stars`, `/gitea_user?tab=activity` and missing under `gitea_user/-/projects` and `gitea_user/-/packages` This was added for users and organizations. Before: ![image](https://user-images.githubusercontent.com/72307968/233338877-f795fae3-b65a-4ea1-8784-dd2b0cd6618f.png) After: ![image](https://user-images.githubusercontent.com/72307968/233339012-90adb6c4-4de2-432e-ae49-69611eb7aec3.png) Co-authored-by: silverwind Co-authored-by: Giteabot --- routers/web/org/members.go | 1 + routers/web/org/teams.go | 1 + templates/user/overview/header.tmpl | 9 ++++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/routers/web/org/members.go b/routers/web/org/members.go index 8361da6632..1953a8b284 100644 --- a/routers/web/org/members.go +++ b/routers/web/org/members.go @@ -62,6 +62,7 @@ func Members(ctx *context.Context) { } ctx.Data["Page"] = pager ctx.Data["Members"] = members + ctx.Data["ContextUser"] = ctx.ContextUser ctx.Data["MembersIsPublicMember"] = membersIsPublic ctx.Data["MembersIsUserOrgOwner"] = organization.IsUserOrgOwner(members, org.ID) ctx.Data["MembersTwoFaStatus"] = members.GetTwoFaStatus() diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go index e2ec6d8785..bae8e5a003 100644 --- a/routers/web/org/teams.go +++ b/routers/web/org/teams.go @@ -56,6 +56,7 @@ func Teams(ctx *context.Context) { } } ctx.Data["Teams"] = ctx.Org.Teams + ctx.Data["ContextUser"] = ctx.ContextUser ctx.HTML(http.StatusOK, tplTeams) } diff --git a/templates/user/overview/header.tmpl b/templates/user/overview/header.tmpl index ed0175dc93..10227a3ebd 100644 --- a/templates/user/overview/header.tmpl +++ b/templates/user/overview/header.tmpl @@ -20,6 +20,9 @@