mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 01:10:12 +01:00
Add Trello attached links to the card description
This commit is contained in:
parent
df54863e72
commit
1083a92816
2 changed files with 52 additions and 28 deletions
|
|
@ -981,5 +981,6 @@
|
||||||
"due-date": "Due Date",
|
"due-date": "Due Date",
|
||||||
"title-alphabetically": "Title (Alphabetically)",
|
"title-alphabetically": "Title (Alphabetically)",
|
||||||
"created-at-newest-first": "Created At (Newest First)",
|
"created-at-newest-first": "Created At (Newest First)",
|
||||||
"created-at-oldest-first": "Created At (Oldest First)"
|
"created-at-oldest-first": "Created At (Oldest First)",
|
||||||
|
"links-heading": "Links"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,13 @@ export class TrelloCreator {
|
||||||
const attachments = this.attachments[card.id];
|
const attachments = this.attachments[card.id];
|
||||||
const trelloCoverId = card.idAttachmentCover;
|
const trelloCoverId = card.idAttachmentCover;
|
||||||
if (attachments) {
|
if (attachments) {
|
||||||
|
const links = [];
|
||||||
attachments.forEach(att => {
|
attachments.forEach(att => {
|
||||||
|
// if the attachment `name` and `url` are the same, then the
|
||||||
|
// attachment is an attached link
|
||||||
|
if (att.name === att.url) {
|
||||||
|
links.push(att.url);
|
||||||
|
} else {
|
||||||
const file = new FS.File();
|
const file = new FS.File();
|
||||||
// Simulating file.attachData on the client generates multiple errors
|
// Simulating file.attachData on the client generates multiple errors
|
||||||
// - HEAD returns null, which causes exception down the line
|
// - HEAD returns null, which causes exception down the line
|
||||||
|
|
@ -447,8 +453,25 @@ export class TrelloCreator {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// todo XXX set cover - if need be
|
// todo XXX set cover - if need be
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (links.length) {
|
||||||
|
let desc = cardToCreate.description.trim();
|
||||||
|
if (desc) {
|
||||||
|
desc += '\n\n';
|
||||||
|
}
|
||||||
|
desc += `## ${TAPi18n.__('links-heading')}\n`;
|
||||||
|
links.forEach(link => {
|
||||||
|
desc += `* ${link}\n`;
|
||||||
|
});
|
||||||
|
Cards.direct.update(cardId, {
|
||||||
|
$set: {
|
||||||
|
description: desc,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result.push(cardId);
|
result.push(cardId);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue