Skip to content

Commit c93e239

Browse files
raizasafeelmergify[bot]
authored andcommitted
fix(lesson): handle lessons with no editor content
(cherry picked from commit 3fa55f6)
1 parent f381c55 commit c93e239

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

frontend/src/pages/Lesson.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,11 +784,17 @@ onBeforeUnmount(() => {
784784
785785
const checkIfDiscussionsAllowed = () => {
786786
hasQuiz.value = false
787-
JSON.parse(lesson.data?.content)?.blocks?.forEach((block) => {
788-
if (block.type === 'quiz') {
789-
hasQuiz.value = true
787+
if (lesson.data?.content) {
788+
try {
789+
JSON.parse(lesson.data.content)?.blocks?.forEach((block) => {
790+
if (block.type === 'quiz') {
791+
hasQuiz.value = true
792+
}
793+
})
794+
} catch {
795+
// legacy markdown lessons
790796
}
791-
})
797+
}
792798
793799
if (
794800
!hasQuiz.value &&

0 commit comments

Comments
 (0)