@@ -7,9 +7,6 @@ package models
7
7
import (
8
8
"fmt"
9
9
10
- "code.gitea.io/gitea/modules/log"
11
- api "code.gitea.io/gitea/modules/structs"
12
-
13
10
"xorm.io/xorm"
14
11
)
15
12
@@ -65,31 +62,6 @@ func isUserAssignedToIssue(e Engine, issue *Issue, user *User) (isAssigned bool,
65
62
return e .Get (& IssueAssignees {IssueID : issue .ID , AssigneeID : user .ID })
66
63
}
67
64
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
-
93
65
// MakeAssigneeList concats a string with all names of the assignees. Useful for logs.
94
66
func MakeAssigneeList (issue * Issue ) (assigneeList string , err error ) {
95
67
err = issue .loadAssignees (x )
@@ -131,8 +103,6 @@ func (issue *Issue) ToggleAssignee(doer *User, assigneeID int64) (removed bool,
131
103
return false , nil , err
132
104
}
133
105
134
- go HookQueue .Add (issue .RepoID )
135
-
136
106
return removed , comment , nil
137
107
}
138
108
@@ -158,49 +128,6 @@ func (issue *Issue) toggleAssignee(sess *xorm.Session, doer *User, assigneeID in
158
128
return removed , comment , err
159
129
}
160
130
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
- }
204
131
return removed , comment , nil
205
132
}
206
133
0 commit comments