mirror of
https://github.com/wekan/wekan.git
synced 2026-01-04 16:48:49 +01:00
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:
parent
58d760a615
commit
fbb0ed5ec1
3 changed files with 60 additions and 8 deletions
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue