mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Wire organization bulk controls, preserve Jira ADF descriptions and activity-independent attachments, skip empty CSV rows, and reject invalid source shapes. Apply the import-disable switch and shared transfer validation to Trello HTTP imports. Add documented dummy format fixtures, positive and negative browser checks, menu inventory guards, and an implementation audit with explicit coverage and format limitations. Thirty new Chromium checks and the corrected cross-board move regression pass on macOS ARM64 with FerretDB; focused Node suites pass. Thanks to xet7.
20 lines
850 B
JavaScript
20 lines
850 B
JavaScript
// File records are authoritative: activity history may be pruned or absent.
|
|
// Older exports stored the card association only in addAttachment activities.
|
|
export function importedAttachmentsByCard(board) {
|
|
const result = Object.create(null);
|
|
const legacyCards = new Map();
|
|
for (const activity of board.activities || []) {
|
|
if (activity.activityType === 'addAttachment') {
|
|
legacyCards.set(activity.attachmentId, activity.cardId);
|
|
}
|
|
}
|
|
const seen = new Set();
|
|
for (const attachment of board.attachments || []) {
|
|
const cardId = attachment.meta?.cardId || attachment.cardId || legacyCards.get(attachment._id);
|
|
if (!cardId || (!attachment.file && !attachment.url) || seen.has(attachment._id)) continue;
|
|
if (attachment._id) seen.add(attachment._id);
|
|
(result[cardId] ||= []).push(attachment);
|
|
}
|
|
return result;
|
|
}
|