diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue index 834a19190d..a7afdab919 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue @@ -1,12 +1,27 @@ @@ -445,7 +639,7 @@ return '-'; }, hasLearningActivities() { - return this.node && Object.keys(this.node.learning_activities).length > 0; + return this.node && Object.keys(this.node.learning_activities || []).length > 0; }, assessmentItems() { return this.getAssessmentItems(this.nodeId); @@ -591,7 +785,7 @@ return formatter.format(list); }, level(levels) { - const ids = Object.keys(levels); + const ids = Object.keys(levels || []); const matches = Object.keys(ContentLevels) .sort() .filter(k => ids.includes(ContentLevels[k])); @@ -616,7 +810,7 @@ } }, accessibilityOptions(options) { - const ids = Object.keys(options); + const ids = Object.keys(options || []); const matches = Object.keys(AccessibilityCategories) .sort() .filter(k => ids.includes(AccessibilityCategories[k])); @@ -627,7 +821,7 @@ } }, category(options) { - const ids = Object.keys(options); + const ids = Object.keys(options || []); const matches = Object.keys(Categories) .sort() .filter(k => ids.includes(Categories[k])); diff --git a/contentcuration/contentcuration/frontend/shared/mixins.js b/contentcuration/contentcuration/frontend/shared/mixins.js index b2efe145dc..cb452bcd4d 100644 --- a/contentcuration/contentcuration/frontend/shared/mixins.js +++ b/contentcuration/contentcuration/frontend/shared/mixins.js @@ -180,7 +180,11 @@ export const constantStrings = createTranslator('ConstantStrings', { export const constantsTranslationMixin = { methods: { translateConstant(constant) { - return constantStrings.$tr(constant); + /* + * Prevent translation of null, undefined and empty keys. Initially, translation would + * default to `ConstantStrings.` if not found, which is not desired on the front-end. + */ + return constant && constantStrings.$tr(constant); }, translateLanguage(language) { return Languages.has(language) && Languages.get(language).native_name;