@@ -327,26 +327,26 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) (err e
327
327
328
328
// Delete labels that belong to the old organization and comments that added these labels
329
329
if oldOwner .IsOrganization () {
330
- if _ , err := sess .Exec (`DELETE FROM issue_label AS il WHERE il .id IN (
330
+ if _ , err := sess .Exec (`DELETE FROM issue_label WHERE issue_label .id IN (
331
331
SELECT il_too.id FROM (
332
- SELECT issue_label .id
333
- FROM issue_label
334
- INNER JOIN label ON issue_label .id = label.id
335
- INNER JOIN issue on issue.id = issue_label .issue_id
332
+ SELECT il_too_too .id
333
+ FROM issue_label AS il_too_too
334
+ INNER JOIN label ON il_too_too .id = label.id
335
+ INNER JOIN issue on issue.id = il_too_too .issue_id
336
336
WHERE
337
337
issue.repo_id = ? AND (issue.repo_id != label.repo_id OR (label.repo_id = 0 AND label.org_id != ?))
338
338
) AS il_too )` , repo .ID , newOwner .ID ); err != nil {
339
339
return fmt .Errorf ("Unable to remove old org labels: %v" , err )
340
340
}
341
341
342
- if _ , err := sess .Exec (`DELETE FROM comment AS com WHERE com .id IN (
342
+ if _ , err := sess .Exec (`DELETE FROM comment WHERE comment .id IN (
343
343
SELECT il_too.id FROM (
344
344
SELECT comment.id
345
- FROM comment
346
- INNER JOIN label ON comment .label_id = label.id
347
- INNER JOIN issue on issue.id = comment .issue_id
345
+ FROM comment AS com
346
+ INNER JOIN label ON com .label_id = label.id
347
+ INNER JOIN issue on issue.id = com .issue_id
348
348
WHERE
349
- comment .type = ? AND issue.repo_id = ? AND (issue.repo_id != label.repo_id OR (label.repo_id = 0 AND label.org_id != ?))
349
+ com .type = ? AND issue.repo_id = ? AND (issue.repo_id != label.repo_id OR (label.repo_id = 0 AND label.org_id != ?))
350
350
) AS il_too)` , CommentTypeLabel , repo .ID , newOwner .ID ); err != nil {
351
351
return fmt .Errorf ("Unable to remove old org label comments: %v" , err )
352
352
}
0 commit comments