aboutsummaryrefslogtreecommitdiffstats
path: root/routers/user/notification.go
diff options
context:
space:
mode:
authorMorgan Bazalgette <git@howl.moe>2018-01-10 22:34:17 +0100
committerLauris BH <lauris@nix.lv>2018-01-10 23:34:17 +0200
commit65861900cda3bb6d9e2aa80b808b0000383c04b3 (patch)
tree8569d93b6ef092b30b35a4d4da906c6b6950e2ee /routers/user/notification.go
parent45c264f681e3f7e1a22a191029836a690959aac3 (diff)
downloadgitea-65861900cda3bb6d9e2aa80b808b0000383c04b3.tar.gz
gitea-65861900cda3bb6d9e2aa80b808b0000383c04b3.zip
Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound * Change Handle(403) to NotFound, avoid using macaron's NotFound
Diffstat (limited to 'routers/user/notification.go')
-rw-r--r--routers/user/notification.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/user/notification.go b/routers/user/notification.go
index c7f23afe69..32cacdd2c4 100644
--- a/routers/user/notification.go
+++ b/routers/user/notification.go
@@ -30,7 +30,7 @@ func GetNotificationCount(c *context.Context) {
count, err := models.GetNotificationCount(c.User, models.NotificationStatusUnread)
if err != nil {
- c.Handle(500, "GetNotificationCount", err)
+ c.ServerError("GetNotificationCount", err)
return
}
@@ -62,13 +62,13 @@ func Notifications(c *context.Context) {
statuses := []models.NotificationStatus{status, models.NotificationStatusPinned}
notifications, err := models.NotificationsForUser(c.User, statuses, page, perPage)
if err != nil {
- c.Handle(500, "ErrNotificationsForUser", err)
+ c.ServerError("ErrNotificationsForUser", err)
return
}
total, err := models.GetNotificationCount(c.User, status)
if err != nil {
- c.Handle(500, "ErrGetNotificationCount", err)
+ c.ServerError("ErrGetNotificationCount", err)
return
}
@@ -100,12 +100,12 @@ func NotificationStatusPost(c *context.Context) {
case "pinned":
status = models.NotificationStatusPinned
default:
- c.Handle(500, "InvalidNotificationStatus", errors.New("Invalid notification status"))
+ c.ServerError("InvalidNotificationStatus", errors.New("Invalid notification status"))
return
}
if err := models.SetNotificationStatus(notificationID, c.User, status); err != nil {
- c.Handle(500, "SetNotificationStatus", err)
+ c.ServerError("SetNotificationStatus", err)
return
}
@@ -117,7 +117,7 @@ func NotificationStatusPost(c *context.Context) {
func NotificationPurgePost(c *context.Context) {
err := models.UpdateNotificationStatuses(c.User, models.NotificationStatusUnread, models.NotificationStatusRead)
if err != nil {
- c.Handle(500, "ErrUpdateNotificationStatuses", err)
+ c.ServerError("ErrUpdateNotificationStatuses", err)
return
}