mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 03:52:36 +02:00
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.
This commit is contained in:
1 parent
7641fc3a8c
commit
4bebd86285
2 files changed
+6
-1
No files matched your search
@@ -274,7 +274,11 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
|||||||
ctx.ServerError("GetUserOrganizations", err)
|
ctx.ServerError("GetUserOrganizations", err)
|
||||||
return
|
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
|
total = count
|
||||||
default: // default to "repositories"
|
default: // default to "repositories"
|
||||||
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ func testLinksAsUser(t *testing.T) {
|
|||||||
"/user2",
|
"/user2",
|
||||||
"/user2?tab=stars",
|
"/user2?tab=stars",
|
||||||
"/user2?tab=activity",
|
"/user2?tab=activity",
|
||||||
|
"/user2?tab=organizations",
|
||||||
"/user/settings",
|
"/user/settings",
|
||||||
"/user/settings/account",
|
"/user/settings/account",
|
||||||
"/user/settings/security",
|
"/user/settings/security",
|
||||||
|
|||||||
Reference in new issue
Block a user