Merge pull request #4853 from emanuelschuetze/comments-fix

Fixed XLSX export for empty comments.
This commit is contained in:
Emanuel Schütze 2019-07-14 21:15:03 +02:00 committed by GitHub
commit 1c3d60fe39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,7 +114,11 @@ export class MotionXlsxExportService {
};
})
);
columns.push(...comments.map(commentId => ({ header: this.commentRepo.getViewModel(commentId).getTitle() })));
if (comments) {
columns.push(
...comments.map(commentId => ({ header: this.commentRepo.getViewModel(commentId).getTitle() }))
);
}
worksheet.columns = columns;
@ -148,15 +152,17 @@ export class MotionXlsxExportService {
}
})
);
data.push(
...comments.map(commentId => {
const section = this.commentRepo.getViewModel(commentId);
const motionComment = motion.getCommentForSection(section);
return motionComment && motionComment.comment
? reconvertChars(stripHtmlTags(motionComment.comment))
: '';
})
);
if (comments) {
data.push(
...comments.map(commentId => {
const section = this.commentRepo.getViewModel(commentId);
const motionComment = motion.getCommentForSection(section);
return motionComment && motionComment.comment
? reconvertChars(stripHtmlTags(motionComment.comment))
: '';
})
);
}
return data;
});