mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	[API] Add Reactions (#9220)
* reject reactions wich ar not allowed
* dont duble check CreateReaction now throw ErrForbiddenIssueReaction
* add /repos/{owner}/{repo}/issues/comments/{id}/reactions endpoint
* add Find Functions
* fix some swagger stuff + add issue reaction endpoints + GET ReactionList now use FindReactions...
* explicite Issue Only Reaction for FindReactionsOptions with "-1" commentID
* load issue; load user ...
* return error again
* swagger def canged after LINT
* check if user has ben loaded
* add Tests
* better way of comparing results
* add suggestion
* use different issue for test
(dont interfear with integration test)
* test dont compare Location on timeCompare
* TEST: add forbidden dubble add
* add comments in code to explain
* add settings.UI.ReactionsMap
so if !setting.UI.ReactionsMap[opts.Type] works
			
			
This commit is contained in:
		@@ -657,21 +657,25 @@ func RegisterRoutes(m *macaron.Macaron) {
 | 
			
		||||
						Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueOption{}), repo.CreateIssue)
 | 
			
		||||
					m.Group("/comments", func() {
 | 
			
		||||
						m.Get("", repo.ListRepoIssueComments)
 | 
			
		||||
						m.Combo("/:id", reqToken()).
 | 
			
		||||
							Patch(mustNotBeArchived, bind(api.EditIssueCommentOption{}), repo.EditIssueComment).
 | 
			
		||||
							Delete(repo.DeleteIssueComment)
 | 
			
		||||
						m.Group("/:id", func() {
 | 
			
		||||
							m.Combo("", reqToken()).
 | 
			
		||||
								Patch(mustNotBeArchived, bind(api.EditIssueCommentOption{}), repo.EditIssueComment).
 | 
			
		||||
								Delete(repo.DeleteIssueComment)
 | 
			
		||||
							m.Combo("/reactions", reqToken()).
 | 
			
		||||
								Get(repo.GetIssueCommentReactions).
 | 
			
		||||
								Post(bind(api.EditReactionOption{}), repo.PostIssueCommentReaction).
 | 
			
		||||
								Delete(bind(api.EditReactionOption{}), repo.DeleteIssueCommentReaction)
 | 
			
		||||
						})
 | 
			
		||||
					})
 | 
			
		||||
					m.Group("/:index", func() {
 | 
			
		||||
						m.Combo("").Get(repo.GetIssue).
 | 
			
		||||
							Patch(reqToken(), bind(api.EditIssueOption{}), repo.EditIssue)
 | 
			
		||||
 | 
			
		||||
						m.Group("/comments", func() {
 | 
			
		||||
							m.Combo("").Get(repo.ListIssueComments).
 | 
			
		||||
								Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueCommentOption{}), repo.CreateIssueComment)
 | 
			
		||||
							m.Combo("/:id", reqToken()).Patch(bind(api.EditIssueCommentOption{}), repo.EditIssueCommentDeprecated).
 | 
			
		||||
								Delete(repo.DeleteIssueCommentDeprecated)
 | 
			
		||||
						})
 | 
			
		||||
 | 
			
		||||
						m.Group("/labels", func() {
 | 
			
		||||
							m.Combo("").Get(repo.ListIssueLabels).
 | 
			
		||||
								Post(reqToken(), bind(api.IssueLabelsOption{}), repo.AddIssueLabels).
 | 
			
		||||
@@ -679,12 +683,10 @@ func RegisterRoutes(m *macaron.Macaron) {
 | 
			
		||||
								Delete(reqToken(), repo.ClearIssueLabels)
 | 
			
		||||
							m.Delete("/:id", reqToken(), repo.DeleteIssueLabel)
 | 
			
		||||
						})
 | 
			
		||||
 | 
			
		||||
						m.Group("/times", func() {
 | 
			
		||||
							m.Combo("").Get(repo.ListTrackedTimes).
 | 
			
		||||
								Post(reqToken(), bind(api.AddTimeOption{}), repo.AddTime)
 | 
			
		||||
						})
 | 
			
		||||
 | 
			
		||||
						m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline)
 | 
			
		||||
						m.Group("/stopwatch", func() {
 | 
			
		||||
							m.Post("/start", reqToken(), repo.StartIssueStopwatch)
 | 
			
		||||
@@ -695,6 +697,10 @@ func RegisterRoutes(m *macaron.Macaron) {
 | 
			
		||||
							m.Put("/:user", reqToken(), repo.AddIssueSubscription)
 | 
			
		||||
							m.Delete("/:user", reqToken(), repo.DelIssueSubscription)
 | 
			
		||||
						})
 | 
			
		||||
						m.Combo("/reactions", reqToken()).
 | 
			
		||||
							Get(repo.GetIssueReactions).
 | 
			
		||||
							Post(bind(api.EditReactionOption{}), repo.PostIssueReaction).
 | 
			
		||||
							Delete(bind(api.EditReactionOption{}), repo.DeleteIssueReaction)
 | 
			
		||||
					})
 | 
			
		||||
				}, mustEnableIssuesOrPulls)
 | 
			
		||||
				m.Group("/labels", func() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user