summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-12 16:33:34 +0800
committerGitHub <noreply@github.com>2019-11-12 16:33:34 +0800
commitbb6879d339d83e598a3d9f0974734cd591394369 (patch)
treebc2f40210a5c7a7f30b620fb7fd1efc6ca7ffc07 /routers/user
parent555b1f658198449670c77839bccf010e33ca74db (diff)
downloadgitea-bb6879d339d83e598a3d9f0974734cd591394369.tar.gz
gitea-bb6879d339d83e598a3d9f0974734cd591394369.zip
Improve notification (#8835)
* Improve notifications * batch load user * Update notification only when read * Fix reorder * fix lint * fix test * fix lint * make function meaningful * fix comment
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/notification.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/routers/user/notification.go b/routers/user/notification.go
index 8c23d76fa9..cd6617a233 100644
--- a/routers/user/notification.go
+++ b/routers/user/notification.go
@@ -68,6 +68,25 @@ func Notifications(c *context.Context) {
return
}
+ repos, err := notifications.LoadRepos()
+ if err != nil {
+ c.ServerError("LoadRepos", err)
+ return
+ }
+ if err := repos.LoadAttributes(); err != nil {
+ c.ServerError("LoadAttributes", err)
+ return
+ }
+
+ if err := notifications.LoadIssues(); err != nil {
+ c.ServerError("LoadIssues", err)
+ return
+ }
+ if err := notifications.LoadComments(); err != nil {
+ c.ServerError("LoadComments", err)
+ return
+ }
+
total, err := models.GetNotificationCount(c.User, status)
if err != nil {
c.ServerError("ErrGetNotificationCount", err)