summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-07-17 17:18:10 +0100
committerGitHub <noreply@github.com>2021-07-17 17:18:10 +0100
commit93f31e1897562a588bed1227e46d1a5b34f52524 (patch)
treee7effbf4073f92b60dbf3db08ac4f1a1ea5fb1b9 /routers
parentb08e14bbcf1b30c5266d89f6fdcc3a6cfa0324fa (diff)
downloadgitea-93f31e1897562a588bed1227e46d1a5b34f52524.tar.gz
gitea-93f31e1897562a588bed1227e46d1a5b34f52524.zip
Update notification table with only latest data (#16445)
When marking notifications read the results may be returned out of order or be delayed. This PR sends a sequence number to gitea so that the browser can ensure that only the results of the latest notification change are shown. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/user/notification.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/web/user/notification.go b/routers/web/user/notification.go
index 523e945db9..851af5d647 100644
--- a/routers/web/user/notification.go
+++ b/routers/web/user/notification.go
@@ -50,6 +50,7 @@ func Notifications(c *context.Context) {
return
}
if c.QueryBool("div-only") {
+ c.Data["SequenceNumber"] = c.Query("sequence-number")
c.HTML(http.StatusOK, tplNotificationDiv)
return
}
@@ -175,6 +176,7 @@ func NotificationStatusPost(c *context.Context) {
return
}
c.Data["Link"] = setting.AppURL + "notifications"
+ c.Data["SequenceNumber"] = c.Req.PostFormValue("sequence-number")
c.HTML(http.StatusOK, tplNotificationDiv)
}