Browse Source

#1253 : remove a label also remove its relations

pull/5260/head
isundil 7 years ago
parent
commit
bea2d516f7
  1. 8
      models/repo.go

8
models/repo.go

@ -1743,12 +1743,12 @@ func DeleteRepositoryLabel(id int64, owner *User) (err error) {
return err return err
} }
// TODO remove Repository <> RepositoryLabel relationship if _, err = sess.Delete(&RepositoryRepoLabel{LabelID: id}); err != nil {
label := &RepositoryLabel{ID: id, OwnerID: owner.ID} return fmt.Errorf("remove repository label '%d': %v", id, err)
if _, err = sess.Delete(label); err != nil { }
if _, err = sess.Delete(&RepositoryLabel{ID: id, OwnerID: owner.ID}); err != nil {
return fmt.Errorf("remove repository label '%d': %v", id, err) return fmt.Errorf("remove repository label '%d': %v", id, err)
} }
sess.Where("label_id = ?", id).Delete(&RepositoryRepoLabel{})
return sess.Commit() return sess.Commit()
} }

Loading…
Cancel
Save