From 69c50902003b43f8a17f758702cd4aa4d4d78162 Mon Sep 17 00:00:00 2001 From: whereareiam Date: Thu, 22 Oct 2026 22:43:30 +0200 Subject: [PATCH] fix(notifications): subscriptions and watching beside the notifications sidebar The notifications sidebar linked to Subscriptions, but that page and Watching dropped the sidebar for Forgejo's switches and boxed filter bar. Both now render in the sidebar layout, which becomes a shared template with Subscriptions and Watching marked when current. The subscribed issues sit in a box headed by All, Open and Closed with the Type and Sort menus, as the theme's other lists. Co-Authored-By: Claude Opus 5.5 --- components/common/box-list/box-list.css | 10 ++++- src/build-output.test.ts | 10 +++++ styles/pages/dashboard-lists.css | 8 +++- .../user/notification/notification_div.tmpl | 15 +------ .../notification_subscriptions.tmpl | 43 +++++++++++++++++++ templates/user/notification/sidebar.tmpl | 17 ++++++++ .../user/notification/subscriptions_sort.tmpl | 9 ++++ .../user/notification/subscriptions_type.tmpl | 4 ++ 8 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 templates/user/notification/notification_subscriptions.tmpl create mode 100644 templates/user/notification/sidebar.tmpl create mode 100644 templates/user/notification/subscriptions_sort.tmpl create mode 100644 templates/user/notification/subscriptions_type.tmpl diff --git a/components/common/box-list/box-list.css b/components/common/box-list/box-list.css index 5a724a79..bc08cf7c 100644 --- a/components/common/box-list/box-list.css +++ b/components/common/box-list/box-list.css @@ -81,7 +81,15 @@ font-weight: 600; } -.theme-box-list-header > .theme-dropdown > summary.theme-control { +/* More than one menu on the right of the header (Type and Sort). */ +.theme-box-list-filters { + display: flex; + align-items: center; + gap: 4px; +} + +.theme-box-list-header > .theme-dropdown > summary.theme-control, +.theme-box-list-filters > .theme-dropdown > summary.theme-control { font-weight: 400; } diff --git a/src/build-output.test.ts b/src/build-output.test.ts index 10385caa..8cdceb62 100644 --- a/src/build-output.test.ts +++ b/src/build-output.test.ts @@ -661,6 +661,16 @@ describe("Forgejo 15 native integration", () => { expect(layout).toContain('template "components/common/settings/context"'); }); + it("shows subscriptions and watched repositories in the notifications sidebar layout", () => { + const read = (...parts: string[]) => + fs.readFileSync(path.join(ROOT_DIR, "templates", "user", "notification", ...parts), "utf-8"); + expect(read("notification_div.tmpl")).toContain('template "user/notification/sidebar"'); + const subscriptions = read("notification_subscriptions.tmpl"); + expect(subscriptions).toContain('template "user/notification/sidebar" dict "Data" . "Current" $current'); + expect(subscriptions).toContain('"Items" "user/notification/subscriptions_sort"'); + expect(read("sidebar.tmpl")).toContain('href="{{AppSubUrl}}/notifications/watching"'); + }); + it("matches GitHub's repository About, visibility, and code-search details", () => { const headerStyle = fs.readFileSync(path.join(ROOT_DIR, "styles", "templates", "repo", "header.ts"), "utf-8"); const headerTemplate = fs.readFileSync(path.join(ROOT_DIR, "templates", "repo", "home_header.tmpl"), "utf-8"); diff --git a/styles/pages/dashboard-lists.css b/styles/pages/dashboard-lists.css index 26822b8e..a8e4cd09 100644 --- a/styles/pages/dashboard-lists.css +++ b/styles/pages/dashboard-lists.css @@ -1,4 +1,4 @@ -/* The dashboard's own lists: issues, pull requests and notifications. */ +/* The dashboard's own lists: issues, pull requests, notifications and subscriptions. */ /* The context switcher sits at the top of the sidebar instead of in a bar across the page. */ .dashboard-list-context .secondary-nav { @@ -84,3 +84,9 @@ .dashboard-list-context .ui.secondary.menu > .item { align-self: flex-start; } + +/* Subscriptions: the issue list sits in the box under its header instead of drawing its own border. As specific as + the issue list rule for notification pages, and loaded after it. */ +.page-content.user.notification .theme-box-list #issue-list { + border: 0; +} diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl index 58cd00bf..b511b13c 100644 --- a/templates/user/notification/notification_div.tmpl +++ b/templates/user/notification/notification_div.tmpl @@ -1,18 +1,7 @@
{{$notificationUnreadCount := call .NotificationUnreadCount}} - + {{$current := "unread"}}{{if eq .Status 2}}{{$current = "read"}}{{end}} + {{template "user/notification/sidebar" dict "Data" . "Current" $current}}
diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl new file mode 100644 index 00000000..f1bf838a --- /dev/null +++ b/templates/user/notification/notification_subscriptions.tmpl @@ -0,0 +1,43 @@ +{{/* Subscriptions and watched repositories in the notifications sidebar layout, as the inbox: the heading, then the +subscribed issues in a box headed by All, Open and Closed with Type and Sort, or the watched repositories. */}} +{{template "base/head" .}} +{{$current := "subscriptions"}}{{if eq .Status 2}}{{$current = "watching"}}{{end}} +
+ {{template "user/notification/sidebar" dict "Data" . "Current" $current}} +
+
+
+ +

{{if eq .Status 1}}{{ctx.Locale.Tr "notification.subscriptions"}}{{else}}{{ctx.Locale.Tr "notification.watching"}}{{end}}

+
+
+ {{if eq .Status 1}} +
+
+ +
+ {{template "components/common/dropdown/dropdown" dict "Kind" "actions" "Label" (ctx.Locale.Tr "repo.issues.filter_type") "Quiet" true "Items" "user/notification/subscriptions_type" "Data" .}} + {{template "components/common/dropdown/dropdown" dict "Kind" "actions" "Label" (ctx.Locale.Tr "repo.issues.filter_sort") "Quiet" true "Items" "user/notification/subscriptions_sort" "Data" .}} +
+
+ {{if .Issues}} + {{template "shared/issuelist" dict "." . "listType" "dashboard"}} + {{else}} +
+ {{svg "octicon-bell" 24}} +

{{ctx.Locale.Tr "notification.no_subscriptions"}}

+
+ {{end}} +
+ {{else}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + {{end}} +
+
+{{template "base/footer" .}} diff --git a/templates/user/notification/sidebar.tmpl b/templates/user/notification/sidebar.tmpl new file mode 100644 index 00000000..4454ae61 --- /dev/null +++ b/templates/user/notification/sidebar.tmpl @@ -0,0 +1,17 @@ +{{/* The notifications sidebar, shared by the inbox and the subscription pages. Data is the page context; Current names +the page (unread, read, subscriptions or watching). */}} +{{$notificationUnreadCount := call .Data.NotificationUnreadCount}} + diff --git a/templates/user/notification/subscriptions_sort.tmpl b/templates/user/notification/subscriptions_sort.tmpl new file mode 100644 index 00000000..2af1383f --- /dev/null +++ b/templates/user/notification/subscriptions_sort.tmpl @@ -0,0 +1,9 @@ +{{$query := print "?state=" .State "&issueType=" .IssueType "&labels=" .Labels}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.latest"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.oldest"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.recentupdate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.leastupdate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.mostcomment"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.leastcomment"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.nearduedate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.farduedate"}} diff --git a/templates/user/notification/subscriptions_type.tmpl b/templates/user/notification/subscriptions_type.tmpl new file mode 100644 index 00000000..a438ef33 --- /dev/null +++ b/templates/user/notification/subscriptions_type.tmpl @@ -0,0 +1,4 @@ +{{$query := print "?sort=" .SortType "&state=" .State "&labels=" .Labels}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "all"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "pull_requests"}}