Board copy work now again

- there was an error at attachment copy
- fixes: https://github.com/wekan/wekan/issues/4485#issue-1211353265
This commit is contained in:
Martin Filser 2022-04-30 01:07:55 +02:00
parent 58d760a615
commit fbb0ed5ec1
3 changed files with 60 additions and 8 deletions

View file

@ -5,7 +5,8 @@ import {
TYPE_LINKED_BOARD,
TYPE_LINKED_CARD,
} from '../config/const';
import Attachments from "./attachments";
import Attachments, { fileStoreStrategyFactory } from "./attachments";
import { copyFile } from './lib/fileStoreStrategy.js';
Cards = new Mongo.Collection('cards');
@ -586,11 +587,11 @@ Cards.helpers({
const _id = Cards.insert(this);
// Copy attachments
oldCard.attachments().forEach(att => {
att.cardId = _id;
delete att._id;
return Attachments.insert(att);
});
oldCard.attachments()
.map(att => att.get())
.forEach(att => {
copyFile(att, _id, fileStoreStrategyFactory);
});
// copy checklists
Checklists.find({ cardId: oldId }).forEach(ch => {