Skip to content

Fix the display of org level badges #26504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/context/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
return
}
}
ctx.Data["ContextUser"] = ctx.ContextUser

ctx.Data["CanReadProjects"] = ctx.Org.CanReadUnit(ctx, unit.TypeProjects)
ctx.Data["CanReadPackages"] = ctx.Org.CanReadUnit(ctx, unit.TypePackages)
Expand Down
1 change: 1 addition & 0 deletions modules/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ func RepoAssignment(ctx *Context) context.CancelFunc {
}
ctx.Repo.Owner = owner
ctx.ContextUser = owner
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["Username"] = ctx.Repo.Owner.Name

// redirect link to wiki
Expand Down
1 change: 0 additions & 1 deletion routers/web/org/home.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't there quite a few more manual instances?

routers/web/user/code.go
33:     ctx.Data["ContextUser"] = ctx.ContextUser

routers/web/user/home.go
59:     ctx.Data["ContextUser"] = ctxUser

routers/web/user/setting/profile.go
334:    ctx.Data["ContextUser"] = ctxUser

routers/web/repo/migrate.go
67:     ctx.Data["ContextUser"] = ctxUser
169:    ctx.Data["ContextUser"] = ctxUser

routers/web/repo/repo.go
166:    ctx.Data["ContextUser"] = ctxUser
233:    ctx.Data["ContextUser"] = ctxUser

routers/web/repo/pull.go
174:            ctx.Data["ContextUser"] = ctx.Doer
176:            ctx.Data["ContextUser"] = orgs[0]
222:    ctx.Data["ContextUser"] = ctxUser

routers/web/repo/packages.go
61:     ctx.Data["ContextUser"] = ctx.ContextUser

routers/web/shared/user/header.go
25:     ctx.Data["ContextUser"] = ctx.ContextUser

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the list you given is related to userAssignment
maybe we should also need this in userAssignment 🤔

Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func Home(ctx *context.Context) {
pager.SetDefaultParams(ctx)
pager.AddParam(ctx, "language", "Language")
ctx.Data["Page"] = pager
ctx.Data["ContextUser"] = ctx.ContextUser

ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0

Expand Down
1 change: 0 additions & 1 deletion routers/web/org/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ 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()
Expand Down
1 change: 0 additions & 1 deletion routers/web/org/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func Settings(ctx *context.Context) {
ctx.Data["PageIsSettingsOptions"] = true
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
ctx.Data["RepoAdminChangeTeamAccess"] = ctx.Org.Organization.RepoAdminChangeTeamAccess
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.HTML(http.StatusOK, tplSettingsOptions)
}

Expand Down
1 change: 0 additions & 1 deletion routers/web/org/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func Teams(ctx *context.Context) {
}
}
ctx.Data["Teams"] = ctx.Org.Teams
ctx.Data["ContextUser"] = ctx.ContextUser

ctx.HTML(http.StatusOK, tplTeams)
}
Expand Down
1 change: 0 additions & 1 deletion routers/web/repo/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func Packages(ctx *context.Context) {

ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["IsPackagesPage"] = true
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
ctx.Data["AvailableTypes"] = packages.TypeList
Expand Down
1 change: 0 additions & 1 deletion routers/web/shared/user/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
func prepareContextForCommonProfile(ctx *context.Context) {
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
ctx.Data["ContextUser"] = ctx.ContextUser
ctx.Data["EnableFeed"] = setting.Other.EnableFeed
ctx.Data["FeedURL"] = ctx.ContextUser.HomeLink()
}
Expand Down
1 change: 0 additions & 1 deletion routers/web/user/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func CodeSearch(ctx *context.Context) {
ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
ctx.Data["Title"] = ctx.Tr("explore.code")
ctx.Data["ContextUser"] = ctx.ContextUser

language := ctx.FormTrim("l")
keyword := ctx.FormTrim("q")
Expand Down
1 change: 1 addition & 0 deletions services/context/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func UserAssignmentWeb() func(ctx *context.Context) {
}
}
ctx.ContextUser = userAssignment(ctx.Base, ctx.Doer, errorFn)
ctx.Data["ContextUser"] = ctx.ContextUser
}
}

Expand Down