Skip to content

Commit 2e4add4

Browse files
author
Anton Bracke
committed
improve code
1 parent a9c914f commit 2e4add4

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

routers/web/user/notification.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,6 @@ func NotificationStatusPost(ctx *context.Context) {
180180
ctx.Redirect(url, http.StatusSeeOther)
181181
}
182182

183-
// convert the action to the displayed list
184-
if statusStr == "unread" {
185-
ctx.SetFormString("q", "read")
186-
} else {
187-
ctx.SetFormString("q", "unread")
188-
}
189183
getNotifications(ctx)
190184
if ctx.Written() {
191185
return

templates/user/notification/notification_div.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<div class="notifications-buttons tw-items-center tw-justify-end tw-gap-1 tw-px-1">
7171
{{if ne .Status 3}}
7272
<button type="button" class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.pin"}}"
73-
hx-post="{{AppSubUrl}}/notifications/status"
73+
hx-post="{{AppSubUrl}}/notifications/status?q={{ $.Keyword }}"
7474
hx-target="#notification_div"
7575
hx-swap="outerHTML"
7676
hx-vals='{"notification_id": "{{.ID}}", "status": "pinned", "page": "{{$.Page.Paginater.Current}}", "_csrf": "{{$.CsrfToken}}", "noredirect": "true" }'
@@ -81,7 +81,7 @@
8181
{{end}}
8282
{{if or (eq .Status 1) (eq .Status 3)}}
8383
<button type="button" class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_read"}}"
84-
hx-post="{{AppSubUrl}}/notifications/status"
84+
hx-post="{{AppSubUrl}}/notifications/status?q={{ $.Keyword }}"
8585
hx-target="#notification_div"
8686
hx-swap="outerHTML"
8787
hx-vals='{"notification_id": "{{.ID}}", "status": "read", "page": "{{$.Page.Paginater.Current}}", "_csrf": "{{$.CsrfToken}}", "noredirect": "true"}'
@@ -90,7 +90,7 @@
9090
</button>
9191
{{else if eq .Status 2}}
9292
<button type="button" class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_unread"}}"
93-
hx-post="{{AppSubUrl}}/notifications/status"
93+
hx-post="{{AppSubUrl}}/notifications/status?q={{ $.Keyword }}"
9494
hx-target="#notification_div"
9595
hx-swap="outerHTML"
9696
hx-vals='{"notification_id": "{{.ID}}", "status": "unread", "page": "{{$.Page.Paginater.Current}}", "_csrf": "{{$.CsrfToken}}", "noredirect": "true"}'

0 commit comments

Comments
 (0)