@@ -171,25 +171,34 @@ func toggleUserAssignee(e *xorm.Session, issue *Issue, assigneeID int64) (remove
171
171
// MakeIDsFromAPIAssigneesToAdd returns an array with all assignee IDs
172
172
func MakeIDsFromAPIAssigneesToAdd (oneAssignee string , multipleAssignees []string ) (assigneeIDs []int64 , err error ) {
173
173
174
- // Keeping the old assigning method for compatibility reasons
175
- if oneAssignee != "" {
176
-
177
- // Prevent double adding assignees
178
- var isDouble bool
179
- for _ , assignee := range multipleAssignees {
180
- if assignee == oneAssignee {
181
- isDouble = true
182
- break
183
- }
174
+ var requestAssignees []string
175
+
176
+ // Prevent double adding assignees and empty assignees
177
+ var isDouble bool
178
+ for _ , assignee := range multipleAssignees {
179
+ // Keeping the old assigning method for compatibility reasons
180
+ if assignee == oneAssignee {
181
+ isDouble = true
182
+ continue
184
183
}
185
184
186
- if ! isDouble {
187
- multipleAssignees = append (multipleAssignees , oneAssignee )
185
+ //if assignee is empty skip
186
+ if len (assignee ) == 0 {
187
+ continue
188
188
}
189
+ requestAssignees = append (requestAssignees , assignee )
189
190
}
190
191
191
- // Get the IDs of all assignees
192
- assigneeIDs , err = GetUserIDsByNames (multipleAssignees , false )
192
+ if ! isDouble {
193
+ requestAssignees = append (requestAssignees , oneAssignee )
194
+ }
195
+
196
+ if len (requestAssignees ) > 0 {
197
+ // Get the IDs of all assignees
198
+ assigneeIDs , err = GetUserIDsByNames (requestAssignees , false )
199
+ } else {
200
+ return nil , nil
201
+ }
193
202
194
203
return
195
204
}
0 commit comments