mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Extract actions on new pull request from models to pulls service and move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull (#8218)
* extract actions on new pull request from models to pulls service * improve code * move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull * fix fmt * Rename pulls.go to pull.go
This commit is contained in:
		| @@ -700,33 +700,6 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str | ||||
| 		return fmt.Errorf("Commit: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	if err = NotifyWatchers(&Action{ | ||||
| 		ActUserID: pull.Poster.ID, | ||||
| 		ActUser:   pull.Poster, | ||||
| 		OpType:    ActionCreatePullRequest, | ||||
| 		Content:   fmt.Sprintf("%d|%s", pull.Index, pull.Title), | ||||
| 		RepoID:    repo.ID, | ||||
| 		Repo:      repo, | ||||
| 		IsPrivate: repo.IsPrivate, | ||||
| 	}); err != nil { | ||||
| 		log.Error("NotifyWatchers: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	pr.Issue = pull | ||||
| 	pull.PullRequest = pr | ||||
| 	mode, _ := AccessLevel(pull.Poster, repo) | ||||
| 	if err = PrepareWebhooks(repo, HookEventPullRequest, &api.PullRequestPayload{ | ||||
| 		Action:      api.HookIssueOpened, | ||||
| 		Index:       pull.Index, | ||||
| 		PullRequest: pr.APIFormat(), | ||||
| 		Repository:  repo.APIFormat(mode), | ||||
| 		Sender:      pull.Poster.APIFormat(), | ||||
| 	}); err != nil { | ||||
| 		log.Error("PrepareWebhooks: %v", err) | ||||
| 	} else { | ||||
| 		go HookQueue.Add(repo.ID) | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user