codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

feat: repository quick-switcher dropdown in repo header #39

Merged
pat-s merged 10 commits from t3code/7fc28a38 into v15.0/forgejo-codefloe 2026-06-24 11:33:27 +00:00
Owner

What

Adds a GitHub-style repository quick-switcher to the repo header.
A caret button next to the owner / repo breadcrumb opens a searchable dropdown listing the current owner's other repositories, so you can jump between repos of the same user/org without leaving the page.

How it works

  • Backend: a new web endpoint GET /{owner}/{repo}/repo-switcher/list returns the owner's repositories as JSON, capped at 100 and sorted by most-recently-updated.
    Visibility is delegated entirely to SearchRepository's Actor filter, so private repos only appear for viewers allowed to see them; anonymous users see only public repos.
    Collaborate: false scopes results to repos the owner actually owns, not repos they merely collaborate on elsewhere.
  • Frontend: a new RepoSwitcher.vue component (mirroring the existing RepoBranchTagSelector.vue pattern) mounts on a caret in the header.
    It fetches the list once on first open, then filters client-side as you type.
    Keyboard navigation (arrow keys, Enter, Escape) and click-outside-to-close are supported; the current repo is highlighted.
  • Capping: when the owner has more than 100 repos, a "Search all repositories" footer link points to the owner's profile.
  • The caret is always rendered for a consistent header, even when the owner has a single repository.

Scope

Intentionally limited to the current owner's repositories — no cross-owner search and no recent-visit tracking.

Tests

  • Integration test TestRepoSwitcherList covers three permission paths: anonymous (public only), owner (sees own private repos), and a third-party authenticated user (cannot see the owner's private repos).
  • A vitest unit test covers the filterRepos case-insensitive substring helper.
## What Adds a GitHub-style repository quick-switcher to the repo header. A caret button next to the `owner / repo` breadcrumb opens a searchable dropdown listing the current owner's other repositories, so you can jump between repos of the same user/org without leaving the page. ## How it works - **Backend:** a new web endpoint `GET /{owner}/{repo}/repo-switcher/list` returns the owner's repositories as JSON, capped at 100 and sorted by most-recently-updated. Visibility is delegated entirely to `SearchRepository`'s `Actor` filter, so private repos only appear for viewers allowed to see them; anonymous users see only public repos. `Collaborate: false` scopes results to repos the owner actually owns, not repos they merely collaborate on elsewhere. - **Frontend:** a new `RepoSwitcher.vue` component (mirroring the existing `RepoBranchTagSelector.vue` pattern) mounts on a caret in the header. It fetches the list once on first open, then filters client-side as you type. Keyboard navigation (arrow keys, Enter, Escape) and click-outside-to-close are supported; the current repo is highlighted. - **Capping:** when the owner has more than 100 repos, a "Search all repositories" footer link points to the owner's profile. - The caret is always rendered for a consistent header, even when the owner has a single repository. ## Scope Intentionally limited to the current owner's repositories — no cross-owner search and no recent-visit tracking. ## Tests - Integration test `TestRepoSwitcherList` covers three permission paths: anonymous (public only), owner (sees own private repos), and a third-party authenticated user (cannot see the owner's private repos). - A vitest unit test covers the `filterRepos` case-insensitive substring helper.
test: assert third-party users cannot see owner private repos via repo-switcher
Some checks failed
testing / frontend-checks (pull_request) Failing after 1m26s
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-remote-cacher (redict) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
testing / backend-checks (pull_request) Has been cancelled
0a36eb0122
fix: type window.config.pageData for repo-switcher tsc check
Some checks failed
testing / frontend-checks (pull_request) Successful in 1m41s
testing / test-sqlite (pull_request) Has been skipped
testing / backend-checks (pull_request) Failing after 6m5s
testing / test-unit (pull_request) Has been skipped
testing / test-e2e (pull_request) Has been skipped
testing / test-pgsql (pull_request) Has been skipped
testing / test-mysql (pull_request) Has been skipped
testing / test-remote-cacher (redis) (pull_request) Has been skipped
testing / test-remote-cacher (valkey) (pull_request) Has been skipped
testing / test-remote-cacher (garnet) (pull_request) Has been skipped
testing / test-remote-cacher (redict) (pull_request) Has been skipped
76670fc148
The new .ts init file is the first TypeScript consumer of
window.config.pageData, so tsc flagged the untyped access that the
existing .js dropdowns never exercised.
Declare pageData on the global config type and read the switcher data
list through a typed cast, which also guards against a missing list.
fix: make repo-switcher an icon-only toggle and remove load flash
Some checks failed
testing / frontend-checks (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-remote-cacher (redict) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
testing / backend-checks (pull_request) Has been cancelled
85ffde40b2
Drop the Fomantic basic-button chrome so the toggle shows just the
triangle icon, matching GitHub's repo dropdown.

Move the toggle styling into global header.css (not Vue-scoped) and
render a static placeholder caret in the template that the Vue component
replaces on mount. Because the placeholder and the mounted button share
the same class and global styles, the caret is visible immediately on
page load instead of popping in once the lazy component chunk resolves,
removing the flashy delay on every repo page.
fix: rename RepoSwitcherList to SwitcherList to satisfy revive
Some checks failed
testing / backend-checks (pull_request) Successful in 8m12s
testing / test-unit (pull_request) Successful in 19m16s
testing / test-remote-cacher (redict) (pull_request) Successful in 3m57s
testing / frontend-checks (pull_request) Successful in 1m29s
testing / test-pgsql (pull_request) Successful in 47m12s
testing / test-remote-cacher (valkey) (pull_request) Successful in 5m21s
testing / test-remote-cacher (redis) (pull_request) Successful in 5m44s
testing / test-remote-cacher (garnet) (pull_request) Successful in 3m56s
testing / test-mysql (pull_request) Successful in 29m13s
testing / test-sqlite (pull_request) Successful in 42m32s
testing / test-e2e (pull_request) Failing after 29m31s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
0ddf33c305
revive flags repo.RepoSwitcherList as stutter; the package is already
named repo, so SwitcherList reads as repo.SwitcherList at call sites.
pat-s merged commit 8a05414dcd into v15.0/forgejo-codefloe 2026-06-24 11:33:27 +00:00
pat-s deleted branch t3code/7fc28a38 2026-06-24 11:33:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!39
No description provided.