Skip to content

Add pagination and search box to org teams list#37245

Merged
silverwind merged 51 commits intogo-gitea:mainfrom
PineBale:patch-orgpage
Apr 17, 2026
Merged

Add pagination and search box to org teams list#37245
silverwind merged 51 commits intogo-gitea:mainfrom
PineBale:patch-orgpage

Conversation

@PineBale
Copy link
Copy Markdown
Contributor

@PineBale PineBale commented Apr 17, 2026

Closes #34482

Replaces #36602
Replaces #37084

  • Add pagination and keyword search to the teams list page
  • 5 teams shown at most in the overview page
1.mp4

kmranimesh and others added 27 commits February 11, 2026 00:16
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 6e5497a.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 17, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

For the avatar size and tooltip, I think we need this for 1.26: Fix team member avatar size and add tooltip #37253

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 17, 2026
@silverwind silverwind enabled auto-merge (squash) April 17, 2026 13:37
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 17, 2026
@wxiaoguang wxiaoguang requested a review from Copilot April 17, 2026 13:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/teams and 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 Owners first.

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.

Comment thread templates/org/team/teams.tmpl Outdated
Comment thread templates/org/team/teams.tmpl
Comment thread templates/org/team/teams.tmpl Outdated
Comment thread routers/web/org/home.go
@wxiaoguang wxiaoguang disabled auto-merge April 17, 2026 13:47
@silverwind silverwind removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 17, 2026
@silverwind silverwind marked this pull request as draft April 17, 2026 14:07
@wxiaoguang
Copy link
Copy Markdown
Contributor

Added team description. Maybe the UI needs to be re-designed in the future.

image

@silverwind
Copy link
Copy Markdown
Member

silverwind commented Apr 17, 2026

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.

@silverwind
Copy link
Copy Markdown
Member

E.g. make it look like #36912 (comment).

@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Apr 17, 2026

The best we can have without redesign:

image

@silverwind
Copy link
Copy Markdown
Member

Looks ok

@silverwind silverwind marked this pull request as ready for review April 17, 2026 15:19
@silverwind silverwind merged commit 18064f7 into go-gitea:main Apr 17, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 17, 2026
Comment thread web_src/css/org.css
}

.page-content.organization .teams .item {
padding: 10px 15px;
Copy link
Copy Markdown
Member

@silverwind silverwind Apr 26, 2026

Choose a reason for hiding this comment

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

@wxiaoguang regression on org homepage from this padding removal:

Image

If this selector overlaps with other content, I guess we should use tailwind.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not only this, but also other problems.

Fix org sidebar layout #37445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paginate, filter and display descriptions of teams in the organization page

6 participants