Skip to content

Commit 4bebd86

Browse files
authored
fix(user): restore organizations tab on user profile (#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.
1 parent 7641fc3 commit 4bebd86

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎routers/web/user/profile.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
274274
ctx.ServerError("GetUserOrganizations", err)
275275
return
276276
}
277-
ctx.Data["Cards"] = orgs
277+
cards := make([]*user_model.User, 0, len(orgs))
278+
for _, org := range orgs {
279+
cards = append(cards, org.AsUser())
280+
}
281+
ctx.Data["Cards"] = cards // user_cards needs User-only methods
278282
total = count
279283
default: // default to "repositories"
280284
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{

‎tests/integration/links_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func testLinksAsUser(t *testing.T) {
172172
"/user2",
173173
"/user2?tab=stars",
174174
"/user2?tab=activity",
175+
"/user2?tab=organizations",
175176
"/user/settings",
176177
"/user/settings/account",
177178
"/user/settings/security",

0 commit comments

Comments
 (0)