summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/notify
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/notify')
-rw-r--r--routers/api/v1/notify/notifications.go4
-rw-r--r--routers/api/v1/notify/repo.go4
-rw-r--r--routers/api/v1/notify/threads.go4
-rw-r--r--routers/api/v1/notify/user.go4
4 files changed, 8 insertions, 8 deletions
diff --git a/routers/api/v1/notify/notifications.go b/routers/api/v1/notify/notifications.go
index 9dd9da85c5..1821c30377 100644
--- a/routers/api/v1/notify/notifications.go
+++ b/routers/api/v1/notify/notifications.go
@@ -22,7 +22,7 @@ func NewAvailable(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/NotificationCount"
- ctx.JSON(http.StatusOK, api.NotificationCount{New: models.CountUnread(ctx.User)})
+ ctx.JSON(http.StatusOK, api.NotificationCount{New: models.CountUnread(ctx.Doer)})
}
func getFindNotificationOptions(ctx *context.APIContext) *models.FindNotificationOptions {
@@ -33,7 +33,7 @@ func getFindNotificationOptions(ctx *context.APIContext) *models.FindNotificatio
}
opts := &models.FindNotificationOptions{
ListOptions: utils.GetListOptions(ctx),
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
UpdatedBeforeUnix: before,
UpdatedAfterUnix: since,
}
diff --git a/routers/api/v1/notify/repo.go b/routers/api/v1/notify/repo.go
index 30357ebd3f..a36bbc6b42 100644
--- a/routers/api/v1/notify/repo.go
+++ b/routers/api/v1/notify/repo.go
@@ -193,7 +193,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
}
opts := &models.FindNotificationOptions{
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
RepoID: ctx.Repo.Repository.ID,
UpdatedBeforeUnix: lastRead,
}
@@ -217,7 +217,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
changed := make([]*structs.NotificationThread, len(nl))
for _, n := range nl {
- notif, err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
+ notif, err := models.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
diff --git a/routers/api/v1/notify/threads.go b/routers/api/v1/notify/threads.go
index 5bfdd4d963..fe89304dc8 100644
--- a/routers/api/v1/notify/threads.go
+++ b/routers/api/v1/notify/threads.go
@@ -87,7 +87,7 @@ func ReadThread(ctx *context.APIContext) {
targetStatus = models.NotificationStatusRead
}
- notif, err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
+ notif, err := models.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
@@ -109,7 +109,7 @@ func getThread(ctx *context.APIContext) *models.Notification {
}
return nil
}
- if n.UserID != ctx.User.ID && !ctx.User.IsAdmin {
+ if n.UserID != ctx.Doer.ID && !ctx.Doer.IsAdmin {
ctx.Error(http.StatusForbidden, "GetNotificationByID", fmt.Errorf("only user itself and admin are allowed to read/change this thread %d", n.ID))
return nil
}
diff --git a/routers/api/v1/notify/user.go b/routers/api/v1/notify/user.go
index 6e4c19d1bf..ac3d0591d0 100644
--- a/routers/api/v1/notify/user.go
+++ b/routers/api/v1/notify/user.go
@@ -141,7 +141,7 @@ func ReadNotifications(ctx *context.APIContext) {
}
}
opts := &models.FindNotificationOptions{
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
UpdatedBeforeUnix: lastRead,
}
if !ctx.FormBool("all") {
@@ -162,7 +162,7 @@ func ReadNotifications(ctx *context.APIContext) {
changed := make([]*structs.NotificationThread, 0, len(nl))
for _, n := range nl {
- notif, err := models.SetNotificationStatus(n.ID, ctx.User, targetStatus)
+ notif, err := models.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return