Use UserNotifications.CountUnseen()

This commit is contained in:
2018-03-03 23:37:30 +01:00
parent 195ec9b0fa
commit 36182d11c7
2 changed files with 18 additions and 8 deletions

View File

@ -17,14 +17,7 @@ func CountUnseen(ctx *aero.Context) string {
return ctx.Error(http.StatusBadRequest, "Not logged in", nil)
}
notifications := user.Notifications().Notifications()
unseen := 0
for _, notification := range notifications {
if notification.Seen == "" {
unseen++
}
}
unseen := user.Notifications().CountUnseen()
return ctx.Text(strconv.Itoa(unseen))
}