fix(caldav): Do not create label if it exists by title (#1444)
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Resolves vikunja/api#1435 Co-authored-by: ce72 <christoph.ernst72@googlemail.com> Reviewed-on: vikunja/api#1444 Co-authored-by: cernst <ce72@noreply.kolaente.de> Co-committed-by: cernst <ce72@noreply.kolaente.de>
This commit is contained in:
parent
33f0d0f85a
commit
5961e56d16
|
@ -411,13 +411,13 @@ func persistLabels(s *xorm.Session, a web.Auth, task *models.Task, labels []*mod
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
labelMap := make(map[int64]*models.Label)
|
labelMap := make(map[string]*models.Label)
|
||||||
for _, l := range existingLabels {
|
for _, l := range existingLabels {
|
||||||
labelMap[l.ID] = &l.Label
|
labelMap[l.Title] = &l.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, label := range labels {
|
for _, label := range labels {
|
||||||
if l, has := labelMap[label.ID]; has {
|
if l, has := labelMap[label.Title]; has {
|
||||||
*label = *l
|
*label = *l
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue