mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move issue notifications (#8713)
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
@@ -237,7 +236,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||
form.Labels = make([]int64, 0)
|
||||
}
|
||||
|
||||
if err := issue_service.NewIssue(ctx.Repo.Repository, issue, form.Labels, nil); err != nil {
|
||||
if err := issue_service.NewIssue(ctx.Repo.Repository, issue, form.Labels, nil, assigneeIDs); err != nil {
|
||||
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||
ctx.Error(400, "UserDoesNotHaveAccessToRepo", err)
|
||||
return
|
||||
@@ -246,13 +245,6 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := issue_service.AddAssignees(issue, ctx.User, assigneeIDs); err != nil {
|
||||
ctx.ServerError("AddAssignees", err)
|
||||
return
|
||||
}
|
||||
|
||||
notification.NotifyNewIssue(issue)
|
||||
|
||||
if form.Closed {
|
||||
if err := issue_service.ChangeStatus(issue, ctx.User, true); err != nil {
|
||||
if models.IsErrDependenciesLeft(err) {
|
||||
|
@@ -305,7 +305,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||
}
|
||||
}
|
||||
|
||||
if err := pull_service.NewPullRequest(repo, prIssue, labelIDs, []string{}, pr, patch); err != nil {
|
||||
if err := pull_service.NewPullRequest(repo, prIssue, labelIDs, []string{}, pr, patch, assigneeIDs); err != nil {
|
||||
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||
ctx.Error(400, "UserDoesNotHaveAccessToRepo", err)
|
||||
return
|
||||
@@ -317,11 +317,6 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||
return
|
||||
}
|
||||
|
||||
if err := issue_service.AddAssignees(prIssue, ctx.User, assigneeIDs); err != nil {
|
||||
ctx.ServerError("AddAssignees", err)
|
||||
return
|
||||
}
|
||||
|
||||
notification.NotifyNewPullRequest(pr)
|
||||
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID)
|
||||
|
Reference in New Issue
Block a user