Add pagination and search box to org teams list#37245
Add pagination and search box to org teams list#37245silverwind merged 51 commits intogo-gitea:mainfrom
Conversation
Add pagination and keyword search to the organization teams list page. Display team descriptions in team cards. - Refactor Teams() handler to use SearchTeam() with ListOptions for server-side pagination and keyword filtering - Add search input with the existing 'search.team_kind' locale string - Show team description in an attached segment below the team name - Add standard pagination widget at the bottom of the list Fixes #34482
Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: silverwind <me@silverwind.io>
# Conflicts: # routers/web/org/home.go
This reverts commit 6f58072
This reverts commit f5773c1.
This reverts commit 824e52c.
This reverts commit f07ea43.
This reverts commit 6e5497a.
…utes" This reverts commit be33fd7.
This reverts commit ed2ca46.
|
For the avatar size and tooltip, I think we need this for 1.26: Fix team member avatar size and add tooltip #37253 |
There was a problem hiding this comment.
Pull request overview
Adds pagination and keyword search to the organization teams list page, and limits the teams shown on the org overview sidebar to a small subset to keep the page usable for orgs with many teams.
Changes:
- Add
?q=keyword search + pagination support to/org/:org/teamsand update the teams list template accordingly. - Limit the org overview sidebar teams list to 5 entries and reuse the shared avatar link template with tooltips.
- Refactor org-context “see all teams” permission logic into a helper and adjust team search sorting to keep
Ownersfirst.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/css/base.css | Adds reusable flex utility classes used by updated templates. |
| tests/integration/org_test.go | Adds integration coverage for teams page permissions, filtering, and pagination. |
| templates/shared/user/avatarlink.tmpl | Adds tooltip content to avatar links (now reused in more places). |
| templates/org/team/teams.tmpl | Adds search UI, pagination rendering, and updates team card header/actions layout. |
| templates/org/team/sidebar.tmpl | Updates header layout and switches leave flow to the show-modal + form-fetch-action pattern. |
| templates/org/home.tmpl | Switches to new org overview data keys and uses shared avatar link template; teams list now uses limited set. |
| services/context/org.go | Extracts UserShouldSeeAllOrgTeams helper and uses it in org assignment flow. |
| routers/web/org/teams.go | Implements paginated/filtered team loading and wires pager + keyword into template data. |
| routers/web/org/home.go | Limits overview teams to 5 (via slicing) and renames template data keys. |
| models/organization/team_list.go | Changes ordering in SearchTeam so Owners appears first. |
Comments suppressed due to low confidence (1)
services/context/org.go:196
- OrgAssignment now calls UserShouldSeeAllOrgTeams(ctx), which queries GetUserTeams for non-owners, and then (when shouldSeeAllTeams is false) calls org.GetUserTeams again to populate ctx.Org.Teams. This results in two DB queries for the same data on the common non-owner path. Consider refactoring to only load user teams once (e.g., have UserShouldSeeAllOrgTeams optionally return the loaded teams, or inline the logic here).
// Team.
shouldSeeAllTeams, err := UserShouldSeeAllOrgTeams(ctx)
if err != nil {
ctx.ServerError("UserShouldSeeAllOrgTeams", err)
return
}
if ctx.Org.IsMember {
if shouldSeeAllTeams {
ctx.Org.Teams, err = org.LoadTeams(ctx)
if err != nil {
ctx.ServerError("LoadTeams", err)
return
}
} else {
ctx.Org.Teams, err = org.GetUserTeams(ctx, ctx.Doer.ID)
if err != nil {
ctx.ServerError("GetUserTeams", err)
return
}
}
ctx.Data["NumTeams"] = len(ctx.Org.Teams)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Would add a horizontal divider that stretches the whole box between description and members and make the description box same bg color as the header, e.g. a double-headered box like in Actions workflow overview. |
|
E.g. make it look like #36912 (comment). |
|
Looks ok |
| } | ||
|
|
||
| .page-content.organization .teams .item { | ||
| padding: 10px 15px; |
There was a problem hiding this comment.
@wxiaoguang regression on org homepage from this padding removal:
If this selector overlaps with other content, I guess we should use tailwind.
There was a problem hiding this comment.
Not only this, but also other problems.
Fix org sidebar layout #37445


Closes #34482
Replaces #36602
Replaces #37084
1.mp4