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>
This commit is contained in:
zeripath 2021-07-17 17:18:10 +01:00 committed by GitHub
parent b08e14bbcf
commit 93f31e1897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 5 deletions

View file

@ -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)
}