summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-07-09 15:15:00 -0400
committerGitHub <noreply@github.com>2023-07-09 19:15:00 +0000
commita5a3c8141274bbcc12e5c4f72b85e02efe47841c (patch)
tree3c4d8c60d1510d466dd97c67665cc9ddd96dfd35
parentea2c9de3c457afb648191b501582a73f7b5498e4 (diff)
downloadgitea-a5a3c8141274bbcc12e5c4f72b85e02efe47841c.tar.gz
gitea-a5a3c8141274bbcc12e5c4f72b85e02efe47841c.zip
Fix notification list bugs (#25781) (#25787)
Backport #25781 by @wxiaoguang Fix #25627 1. `ctx.Data["Link"]` should use relative URL but not AppURL 2. The `data-params` is incorrect because it doesn't contain "page". JS can simply use "window.location.search" to construct the AJAX URL 3. The `data-xxx` and `id` in notification_subscriptions.tmpl were copied&pasted, they don't have affect. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--routers/web/user/notification.go2
-rw-r--r--templates/user/notification/notification_div.tmpl2
-rw-r--r--templates/user/notification/notification_subscriptions.tmpl2
-rw-r--r--web_src/js/features/notification.js2
4 files changed, 4 insertions, 4 deletions
diff --git a/routers/web/user/notification.go b/routers/web/user/notification.go
index e0aa92879f..cae12f4126 100644
--- a/routers/web/user/notification.go
+++ b/routers/web/user/notification.go
@@ -186,7 +186,7 @@ func NotificationStatusPost(ctx *context.Context) {
if ctx.Written() {
return
}
- ctx.Data["Link"] = setting.AppURL + "notifications"
+ ctx.Data["Link"] = setting.AppSubURL + "/notifications"
ctx.Data["SequenceNumber"] = ctx.Req.PostFormValue("sequence-number")
ctx.HTML(http.StatusOK, tplNotificationDiv)
diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl
index 0b46e43b4f..fb640581b6 100644
--- a/templates/user/notification/notification_div.tmpl
+++ b/templates/user/notification/notification_div.tmpl
@@ -1,4 +1,4 @@
-<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
+<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}">
<div class="ui container">
{{$notificationUnreadCount := call .NotificationUnreadCount}}
<div class="gt-df gt-ac gt-sb gt-mb-4">
diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl
index df69a4dad1..26da1eff52 100644
--- a/templates/user/notification/notification_subscriptions.tmpl
+++ b/templates/user/notification/notification_subscriptions.tmpl
@@ -1,5 +1,5 @@
{{template "base/head" .}}
-<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_subscriptions" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
+<div role="main" aria-label="{{.Title}}" class="page-content user notification">
<div class="ui container">
<div class="ui top attached tabular menu">
<a href="{{AppSubUrl}}/notifications/subscriptions" class="{{if eq .Status 1}}active {{end}}item">
diff --git a/web_src/js/features/notification.js b/web_src/js/features/notification.js
index 0c24d36e56..4dcf02d2dc 100644
--- a/web_src/js/features/notification.js
+++ b/web_src/js/features/notification.js
@@ -165,7 +165,7 @@ async function updateNotificationTable() {
if (notificationDiv.length > 0) {
const data = await $.ajax({
type: 'GET',
- url: `${appSubUrl}/notifications?${notificationDiv.data('params')}`,
+ url: `${appSubUrl}/notifications${window.location.search}`,
data: {
'div-only': true,
'sequence-number': ++notificationSequenceNumber,