From 272b620f616e683cf12a83554253255182fd21b6 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 24 Jun 2020 21:42:52 +0000 Subject: [PATCH] --- ayanova/src/api/translation.js | 2 +- ayanova/src/views/adm-translation.vue | 5 ----- ayanova/src/views/home-user-settings.vue | 10 ++++++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index d9ffd715..25c9366e 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -11,7 +11,6 @@ export default { //or they just edited a translation and saved it in translation editor and it's also their own local translation if (editedTranslation) { - console.log("Updating local translation"); //iterate the keys that are cached and set them from whatever is in editedTranslation for that key window.$gz._.forOwn(window.$gz.store.state.translationText, function( cacheval, @@ -28,6 +27,7 @@ export default { }); } else { //gather up the keys that are cached and fetch the latest and then replace them + console.log("STUB:translation:updateCache"); } //if editedTranslation is empty that means just fetch the existing ones freshly again diff --git a/ayanova/src/views/adm-translation.vue b/ayanova/src/views/adm-translation.vue index 256e9320..23cbf54c 100644 --- a/ayanova/src/views/adm-translation.vue +++ b/ayanova/src/views/adm-translation.vue @@ -336,10 +336,6 @@ export default { vm.obj.concurrency = res.data.concurrency; //Update local copy of translations if that's the same one in use - console.log( - "Editing active translation=", - vm.editingActiveTranslation - ); if (vm.editingActiveTranslation) { await window.$gz.translation.updateCache(vm.obj); } @@ -592,7 +588,6 @@ async function fetchTranslatedText(vm) { async function setEditingActiveTranslation(vm) { if (vm.$route.params.recordid != 0) { let res = await window.$gz.api.get("user-option/" + vm.$store.state.userId); - vm.editingActiveTranslation = res.data.translationId == vm.$route.params.recordid; } diff --git a/ayanova/src/views/home-user-settings.vue b/ayanova/src/views/home-user-settings.vue index aff6bf65..adfaddda 100644 --- a/ayanova/src/views/home-user-settings.vue +++ b/ayanova/src/views/home-user-settings.vue @@ -164,6 +164,7 @@ export default { selectLists: { translations: [] }, + activeTranslationId: null, darkMode: this.$store.state.darkMode, obj: { /*concurrency": 7490431, @@ -265,6 +266,7 @@ export default { window.$gz.form.setErrorBoxErrors(vm); } else { vm.obj = res.data; + vm.activeTranslationId = res.data.translationId; //Update the form status window.$gz.form.setFormState({ @@ -332,6 +334,14 @@ export default { } window.$gz.store.commit("setLocale", l); + + if ( + vm.activeTranslationId && + vm.activeTranslationId != vm.obj.translationId + ) { + await window.$gz.translation.updateCache(); + vm.activeTranslationId = vm.obj.translationId; + } } } catch (error) { vm.formState.loading = false;