From 3ee1924069330068b85f2677dfd5c42a9a6519fb Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 4 Oct 2026 00:51:14 -0700 Subject: [PATCH] fix(user): restore organizations tab on user profile (#39577) (#39581) Backport #39577 Fixes #39572 The shared user cards template calls the User-only `IsTypeBot` method. The profile organizations tab passed `*organization.Organization` values to that template, so `/{username}?tab=organizations` returned a 500 error. Organizations are now converted to Users before rendering. Co-authored-by: Zettat123 --- routers/web/user/profile.go | 6 +++++- tests/integration/links_test.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 085977e062d..a342e3b1631 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -274,7 +274,11 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R ctx.ServerError("GetUserOrganizations", err) return } - ctx.Data["Cards"] = orgs + cards := make([]*user_model.User, 0, len(orgs)) + for _, org := range orgs { + cards = append(cards, org.AsUser()) + } + ctx.Data["Cards"] = cards // user_cards needs User-only methods total = count default: // default to "repositories" repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{ diff --git a/tests/integration/links_test.go b/tests/integration/links_test.go index 4836cb4e038..096fa37ad70 100644 --- a/tests/integration/links_test.go +++ b/tests/integration/links_test.go @@ -172,6 +172,7 @@ func testLinksAsUser(t *testing.T) { "/user2", "/user2?tab=stars", "/user2?tab=activity", + "/user2?tab=organizations", "/user/settings", "/user/settings/account", "/user/settings/security",