Add support for list background import

This commit is contained in:
kolaente 2021-09-03 23:26:42 +02:00
parent b9aab001ad
commit a6021706ab
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 14 additions and 1 deletions

View File

@ -131,7 +131,7 @@ type Task struct {
type TaskWithComments struct {
Task
Comments []*TaskComment
Comments []*TaskComment `xorm:"-" json:"comments"`
}
// TableName returns the table name for listtasks

View File

@ -99,6 +99,19 @@ func (v *VikunjaFileMigrator) Migrate(user *user.User, file io.ReaderAt, size in
for _, n := range namespaces {
for _, l := range n.Lists {
if b, exists := storedFiles[l.BackgroundFileID]; exists {
bf, err := b.Open()
if err != nil {
return fmt.Errorf("could not open list background file %d for reading: %s", l.BackgroundFileID, err)
}
var buf bytes.Buffer
if _, err := buf.ReadFrom(bf); err != nil {
return fmt.Errorf("could not read list background file %d: %s", l.BackgroundFileID, err)
}
l.BackgroundInformation = &buf
}
for _, t := range l.Tasks {
for _, label := range t.Labels {
label.ID = 0