Skip to content

Commit

Permalink
Fix bugs related to notification endpoints (go-gitea#25548)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zettat123 authored and GiteaBot committed Jun 28, 2023
1 parent 0eb4ab4 commit 85992ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,11 @@ func Routes(ctx gocontext.Context) *web.Route {
m.Group("/notifications", func() {
m.Combo("").
Get(notify.ListNotifications).
Put(notify.ReadNotifications, reqToken())
Put(reqToken(), notify.ReadNotifications)
m.Get("/new", notify.NewAvailable)
m.Combo("/threads/{id}").
Get(notify.GetThread).
Patch(notify.ReadThread, reqToken())
Patch(reqToken(), notify.ReadThread)
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryNotification))

// Users (requires user scope)
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/notify/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
if len(qLastRead) > 0 {
tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
if err != nil {
ctx.InternalServerError(err)
ctx.Error(http.StatusBadRequest, "Parse", err)
return
}
if !tmpLastRead.IsZero() {
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/notify/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func ReadNotifications(ctx *context.APIContext) {
if len(qLastRead) > 0 {
tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
if err != nil {
ctx.InternalServerError(err)
ctx.Error(http.StatusBadRequest, "Parse", err)
return
}
if !tmpLastRead.IsZero() {
Expand Down

0 comments on commit 85992ce

Please sign in to comment.