Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PaRangger committed Jan 19, 2025
1 parent b4ff379 commit 519b410
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,19 @@ export class LectureAttachmentReferenceAction extends TextEditorAction {
this.lecturesWithDetails = lectures
.filter((lecture) => !!lecture.id && !!lecture.title)
.map((lecture) => {
let attachmentCopy = cloneDeep(lecture.attachments);
const attachmentsWithFileUrls = cloneDeep(lecture.attachments)?.map((attachment) => {
if (attachment.link && attachment.name) {
attachment.link = this.fileService.createAttachmentFileUrl(attachment.link!, attachment.name!, false);
}

if (attachmentCopy) {
attachmentCopy = attachmentCopy.map((attachment) => {
if (attachment.link && attachment.name) {
attachment.link = this.fileService.createAttachmentFileUrl(attachment.link!, attachment.name!, false);
}

return attachment;
});
} else {
attachmentCopy = lecture.attachments;
}
return attachment;
});

return {
id: lecture.id!,
title: lecture.title!,
attachmentUnits: lecture.lectureUnits?.filter((unit) => unit.type === LectureUnitType.ATTACHMENT),
attachments: attachmentCopy,
attachments: attachmentsWithFileUrls,
};
});
}
Expand Down

0 comments on commit 519b410

Please sign in to comment.