|
|
|
|
|
|
|
|
package user |
|
|
package user |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
goctx "context" |
|
|
"errors" |
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"net/http" |
|
|
"net/http" |
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
"code.gitea.io/gitea/models" |
|
|
"code.gitea.io/gitea/modules/base" |
|
|
"code.gitea.io/gitea/modules/base" |
|
|
"code.gitea.io/gitea/modules/context" |
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
"code.gitea.io/gitea/modules/structs" |
|
|
"code.gitea.io/gitea/modules/structs" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
c.Data["NotificationUnreadCount"] = func() int64 { |
|
|
c.Data["NotificationUnreadCount"] = func() int64 { |
|
|
count, err := models.GetNotificationCount(c, c.Doer, models.NotificationStatusUnread) |
|
|
count, err := models.GetNotificationCount(c, c.Doer, models.NotificationStatusUnread) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
c.ServerError("GetNotificationCount", err) |
|
|
|
|
|
|
|
|
if err != goctx.Canceled { |
|
|
|
|
|
log.Error("Unable to GetNotificationCount for user:%-v: %v", c.Doer, err) |
|
|
|
|
|
} |
|
|
return -1 |
|
|
return -1 |
|
|
} |
|
|
} |
|
|
|
|
|
|