Skip to content

Commit 2677cbd

Browse files
wxiaoguangGiteaBot
authored andcommitted
Fix notification list bugs (go-gitea#25781)
Fix go-gitea#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.
1 parent ea2c9de commit 2677cbd

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

routers/web/user/notification.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func NotificationStatusPost(ctx *context.Context) {
186186
if ctx.Written() {
187187
return
188188
}
189-
ctx.Data["Link"] = setting.AppURL + "notifications"
189+
ctx.Data["Link"] = setting.AppSubURL + "/notifications"
190190
ctx.Data["SequenceNumber"] = ctx.Req.PostFormValue("sequence-number")
191191

192192
ctx.HTML(http.StatusOK, tplNotificationDiv)

templates/user/notification/notification_div.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
1+
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}">
22
<div class="ui container">
33
{{$notificationUnreadCount := call .NotificationUnreadCount}}
44
<div class="gt-df gt-ac gt-sb gt-mb-4">

templates/user/notification/notification_subscriptions.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{template "base/head" .}}
2-
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_subscriptions" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
2+
<div role="main" aria-label="{{.Title}}" class="page-content user notification">
33
<div class="ui container">
44
<div class="ui top attached tabular menu">
55
<a href="{{AppSubUrl}}/notifications/subscriptions" class="{{if eq .Status 1}}active {{end}}item">

web_src/js/features/notification.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ async function updateNotificationTable() {
165165
if (notificationDiv.length > 0) {
166166
const data = await $.ajax({
167167
type: 'GET',
168-
url: `${appSubUrl}/notifications?${notificationDiv.data('params')}`,
168+
url: `${appSubUrl}/notifications${window.location.search}`,
169169
data: {
170170
'div-only': true,
171171
'sequence-number': ++notificationSequenceNumber,

0 commit comments

Comments
 (0)