fix(caldav): Do not create label if it exists by title

Resolves vikunja/api#1435
This commit is contained in:
cernst 2023-03-24 12:37:07 +01:00
parent f6e6c5c8fc
commit 6abd212c57
1 changed files with 3 additions and 3 deletions

View File

@ -411,13 +411,13 @@ func persistLabels(s *xorm.Session, a web.Auth, task *models.Task, labels []*mod
return err
}
labelMap := make(map[int64]*models.Label)
labelMap := make(map[string]*models.Label)
for _, l := range existingLabels {
labelMap[l.ID] = &l.Label
labelMap[l.Title] = &l.Label
}
for _, label := range labels {
if l, has := labelMap[label.ID]; has {
if l, has := labelMap[label.Title]; has {
*label = *l
continue
}