Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for notification to avoid il8n error in CoreBase #9138

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions kolibri/core/assets/src/views/CoreBase/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

<GlobalSnackbar />
<UpdateNotification
v-if="!loading && showNotification"
v-if="!loading && showNotification && mostRecentNotification"
:id="mostRecentNotification.id"
:title="mostRecentNotification.title"
:msg="mostRecentNotification.msg"
Expand Down Expand Up @@ -400,18 +400,21 @@
let languageCode = defaultLanguage.id;
// notifications should already be ordered by timestamp
const notification = this.notifications[0];
// check if translated message is available for current language
if (notification.i18n[currentLanguage] !== undefined) {
languageCode = currentLanguage;
if (notification) {
// check if translated message is available for current language
if (notification.i18n[currentLanguage] !== undefined) {
languageCode = currentLanguage;
}
// i18n data structure generated by nutritionfacts_i18n.py
return {
id: notification.id,
title: notification.i18n[languageCode].title,
msg: notification.i18n[languageCode].msg,
linkText: notification.i18n[languageCode].link_text,
linkUrl: notification.link_url,
};
}
// i18n data structure generated by nutritionfacts_i18n.py
return {
id: notification.id,
title: notification.i18n[languageCode].title,
msg: notification.i18n[languageCode].msg,
linkText: notification.i18n[languageCode].link_text,
linkUrl: notification.link_url,
};
return null;
},
contentComponentName() {
return this.$slots.default[0].context.$options.name;
Expand Down