mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Move issue change content from models to service (#8711)
* Move issue change content from models to service * fix lint
This commit is contained in:
		| @@ -277,3 +277,41 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue) { | ||||
| 		go models.HookQueue.Add(issue.RepoID) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) { | ||||
| 	mode, _ := models.AccessLevel(issue.Poster, issue.Repo) | ||||
| 	var err error | ||||
| 	if issue.IsPull { | ||||
| 		issue.PullRequest.Issue = issue | ||||
| 		err = models.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{ | ||||
| 			Action: api.HookIssueEdited, | ||||
| 			Index:  issue.Index, | ||||
| 			Changes: &api.ChangesPayload{ | ||||
| 				Body: &api.ChangesFromPayload{ | ||||
| 					From: oldContent, | ||||
| 				}, | ||||
| 			}, | ||||
| 			PullRequest: issue.PullRequest.APIFormat(), | ||||
| 			Repository:  issue.Repo.APIFormat(mode), | ||||
| 			Sender:      doer.APIFormat(), | ||||
| 		}) | ||||
| 	} else { | ||||
| 		err = models.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{ | ||||
| 			Action: api.HookIssueEdited, | ||||
| 			Index:  issue.Index, | ||||
| 			Changes: &api.ChangesPayload{ | ||||
| 				Body: &api.ChangesFromPayload{ | ||||
| 					From: oldContent, | ||||
| 				}, | ||||
| 			}, | ||||
| 			Issue:      issue.APIFormat(), | ||||
| 			Repository: issue.Repo.APIFormat(mode), | ||||
| 			Sender:     doer.APIFormat(), | ||||
| 		}) | ||||
| 	} | ||||
| 	if err != nil { | ||||
| 		log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err) | ||||
| 	} else { | ||||
| 		go models.HookQueue.Add(issue.RepoID) | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user