@@ -7,9 +7,6 @@ package models
77import (
88 "fmt"
99
10- "code.gitea.io/gitea/modules/log"
11- api "code.gitea.io/gitea/modules/structs"
12-
1310 "xorm.io/xorm"
1411)
1512
@@ -65,31 +62,6 @@ func isUserAssignedToIssue(e Engine, issue *Issue, user *User) (isAssigned bool,
6562 return e .Get (& IssueAssignees {IssueID : issue .ID , AssigneeID : user .ID })
6663}
6764
68- // DeleteNotPassedAssignee deletes all assignees who aren't passed via the "assignees" array
69- func DeleteNotPassedAssignee (issue * Issue , doer * User , assignees []* User ) (err error ) {
70- var found bool
71-
72- for _ , assignee := range issue .Assignees {
73-
74- found = false
75- for _ , alreadyAssignee := range assignees {
76- if assignee .ID == alreadyAssignee .ID {
77- found = true
78- break
79- }
80- }
81-
82- if ! found {
83- // This function also does comments and hooks, which is why we call it seperatly instead of directly removing the assignees here
84- if _ , _ , err := issue .ToggleAssignee (doer , assignee .ID ); err != nil {
85- return err
86- }
87- }
88- }
89-
90- return nil
91- }
92-
9365// MakeAssigneeList concats a string with all names of the assignees. Useful for logs.
9466func MakeAssigneeList (issue * Issue ) (assigneeList string , err error ) {
9567 err = issue .loadAssignees (x )
@@ -131,8 +103,6 @@ func (issue *Issue) ToggleAssignee(doer *User, assigneeID int64) (removed bool,
131103 return false , nil , err
132104 }
133105
134- go HookQueue .Add (issue .RepoID )
135-
136106 return removed , comment , nil
137107}
138108
@@ -158,49 +128,6 @@ func (issue *Issue) toggleAssignee(sess *xorm.Session, doer *User, assigneeID in
158128 return removed , comment , err
159129 }
160130
161- if issue .IsPull {
162- mode , _ := accessLevelUnit (sess , doer , issue .Repo , UnitTypePullRequests )
163-
164- if err = issue .loadPullRequest (sess ); err != nil {
165- return false , nil , fmt .Errorf ("loadPullRequest: %v" , err )
166- }
167- issue .PullRequest .Issue = issue
168- apiPullRequest := & api.PullRequestPayload {
169- Index : issue .Index ,
170- PullRequest : issue .PullRequest .apiFormat (sess ),
171- Repository : issue .Repo .innerAPIFormat (sess , mode , false ),
172- Sender : doer .APIFormat (),
173- }
174- if removed {
175- apiPullRequest .Action = api .HookIssueUnassigned
176- } else {
177- apiPullRequest .Action = api .HookIssueAssigned
178- }
179- // Assignee comment triggers a webhook
180- if err := prepareWebhooks (sess , issue .Repo , HookEventPullRequest , apiPullRequest ); err != nil {
181- log .Error ("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v" , issue .IsPull , removed , err )
182- return false , nil , err
183- }
184- } else {
185- mode , _ := accessLevelUnit (sess , doer , issue .Repo , UnitTypeIssues )
186-
187- apiIssue := & api.IssuePayload {
188- Index : issue .Index ,
189- Issue : issue .apiFormat (sess ),
190- Repository : issue .Repo .innerAPIFormat (sess , mode , false ),
191- Sender : doer .APIFormat (),
192- }
193- if removed {
194- apiIssue .Action = api .HookIssueUnassigned
195- } else {
196- apiIssue .Action = api .HookIssueAssigned
197- }
198- // Assignee comment triggers a webhook
199- if err := prepareWebhooks (sess , issue .Repo , HookEventIssues , apiIssue ); err != nil {
200- log .Error ("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v" , issue .IsPull , removed , err )
201- return false , nil , err
202- }
203- }
204131 return removed , comment , nil
205132}
206133
0 commit comments