allow duplicating cards/baords if filecopy fails (#3012)

* allow duplicating cards/baords if filecopy fails

* change back to error logs
This commit is contained in:
Scott Bishel 2022-05-05 09:40:46 -06:00 committed by GitHub
parent 1ff28087f8
commit 31a3ba8e6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 7 deletions

View file

@ -239,8 +239,6 @@ func (a *App) CopyCardFiles(sourceBoardID string, copiedBlocks []model.Block) er
mlog.String("destinationFilePath", destinationFilePath), mlog.String("destinationFilePath", destinationFilePath),
mlog.Err(err), mlog.Err(err),
) )
return err
} }
block.Fields["fileId"] = destFilename block.Fields["fileId"] = destFilename
} }

View file

@ -150,11 +150,7 @@ func (a *App) DuplicateBoard(boardID, userID, toTeam string, asTemplate bool) (*
// copy any file attachments from the duplicated blocks. // copy any file attachments from the duplicated blocks.
if err = a.CopyCardFiles(boardID, bab.Blocks); err != nil { if err = a.CopyCardFiles(boardID, bab.Blocks); err != nil {
dbab := model.NewDeleteBoardsAndBlocksFromBabs(bab) a.logger.Error("Could not copy files while duplicating board", mlog.String("BoardID", boardID), mlog.Err(err))
if err = a.store.DeleteBoardsAndBlocks(dbab, userID); err != nil {
a.logger.Error("Cannot delete board after duplication error when copying block's files", mlog.String("boardID", bab.Boards[0].ID), mlog.Err(err))
}
return nil, nil, fmt.Errorf("could not copy files while duplicating board %s: %w", boardID, err)
} }
// bab.Blocks now has updated file ids for any blocks containing files. We need to store them. // bab.Blocks now has updated file ids for any blocks containing files. We need to store them.