mirror of
https://github.com/wekan/wekan.git
synced 2026-02-25 09:24:08 +01:00
Manually merged fixes from seve12.
Thanks to seve12 ! Related https://github.com/wekan/wekan/pull/5967
This commit is contained in:
parent
fc3bb962f7
commit
ecfb0f0fdf
14 changed files with 457 additions and 20 deletions
|
|
@ -2107,6 +2107,28 @@ Cards.mutations({
|
|||
Cards.update(this._id, {
|
||||
$set: mutatedFields,
|
||||
});
|
||||
|
||||
// Ensure attachments follow the card to its new board/list/swimlane
|
||||
if (Meteor.isServer) {
|
||||
const updateMeta = {};
|
||||
if (mutatedFields.boardId !== undefined) updateMeta['meta.boardId'] = mutatedFields.boardId;
|
||||
if (mutatedFields.listId !== undefined) updateMeta['meta.listId'] = mutatedFields.listId;
|
||||
if (mutatedFields.swimlaneId !== undefined) updateMeta['meta.swimlaneId'] = mutatedFields.swimlaneId;
|
||||
|
||||
if (Object.keys(updateMeta).length > 0) {
|
||||
try {
|
||||
Attachments.collection.update(
|
||||
{ 'meta.cardId': this._id },
|
||||
{ $set: updateMeta },
|
||||
{ multi: true },
|
||||
);
|
||||
} catch (err) {
|
||||
// Do not block the move if attachment update fails
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Failed to update attachments metadata after moving card', this._id, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addLabel(labelId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue