mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Fix bugs related to notification endpoints (#25548)
This commit is contained in:
		@@ -777,11 +777,11 @@ func Routes() *web.Route {
 | 
				
			|||||||
		m.Group("/notifications", func() {
 | 
							m.Group("/notifications", func() {
 | 
				
			||||||
			m.Combo("").
 | 
								m.Combo("").
 | 
				
			||||||
				Get(notify.ListNotifications).
 | 
									Get(notify.ListNotifications).
 | 
				
			||||||
				Put(notify.ReadNotifications, reqToken())
 | 
									Put(reqToken(), notify.ReadNotifications)
 | 
				
			||||||
			m.Get("/new", notify.NewAvailable)
 | 
								m.Get("/new", notify.NewAvailable)
 | 
				
			||||||
			m.Combo("/threads/{id}").
 | 
								m.Combo("/threads/{id}").
 | 
				
			||||||
				Get(notify.GetThread).
 | 
									Get(notify.GetThread).
 | 
				
			||||||
				Patch(notify.ReadThread, reqToken())
 | 
									Patch(reqToken(), notify.ReadThread)
 | 
				
			||||||
		}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryNotification))
 | 
							}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryNotification))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Users (requires user scope)
 | 
							// Users (requires user scope)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -183,7 +183,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
 | 
				
			|||||||
	if len(qLastRead) > 0 {
 | 
						if len(qLastRead) > 0 {
 | 
				
			||||||
		tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
 | 
							tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			ctx.InternalServerError(err)
 | 
								ctx.Error(http.StatusBadRequest, "Parse", err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if !tmpLastRead.IsZero() {
 | 
							if !tmpLastRead.IsZero() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -132,7 +132,7 @@ func ReadNotifications(ctx *context.APIContext) {
 | 
				
			|||||||
	if len(qLastRead) > 0 {
 | 
						if len(qLastRead) > 0 {
 | 
				
			||||||
		tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
 | 
							tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			ctx.InternalServerError(err)
 | 
								ctx.Error(http.StatusBadRequest, "Parse", err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if !tmpLastRead.IsZero() {
 | 
							if !tmpLastRead.IsZero() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user