fix(events): dispatch pending events in migration and export handlers

Refs #2315
This commit is contained in:
kolaente
2026-03-02 09:19:51 +01:00
parent 924eef58d1
commit 6ed684d708
2 changed files with 14 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ import (
"xorm.io/xorm"
"code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/events"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/modules/background/handler"
@@ -38,10 +39,18 @@ func InsertFromStructure(str []*models.ProjectWithTasksAndBuckets, user *user.Us
if err != nil {
log.Errorf("[creating structure] Error while creating structure: %s", err.Error())
_ = s.Rollback()
events.CleanupPending(s)
return err
}
return s.Commit()
err = s.Commit()
if err != nil {
events.CleanupPending(s)
return err
}
events.DispatchPending(s)
return nil
}
func insertFromStructure(s *xorm.Session, str []*models.ProjectWithTasksAndBuckets, user *user.User) (err error) {