From 3727e4c66ae570a2361bc6a9e19973f024bd8318 Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 22 Sep 2021 06:52:25 +0800 Subject: [PATCH] Fix module bar relative links from opening externally (#8130) * Fix module bar relative links from opening externally * Remove conditional logic from vue template * Cleanup link rendering Co-authored-by: rijkvanzanten --- app/src/views/private/components/module-bar.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/views/private/components/module-bar.vue b/app/src/views/private/components/module-bar.vue index ebaef39533..2a9376e6a3 100644 --- a/app/src/views/private/components/module-bar.vue +++ b/app/src/views/private/components/module-bar.vue @@ -10,7 +10,7 @@ icon x-large :to="modulePart.to" - :href="modulePart.url" + :href="modulePart.href" tile :style=" modulePart.color @@ -35,6 +35,7 @@ import ModuleBarAvatar from './module-bar-avatar/'; import { useSettingsStore } from '@/stores/'; import { translate } from '@/utils/translate-object-values'; import { MODULE_BAR_DEFAULT } from '@/constants'; +import { omit } from 'lodash'; export default defineComponent({ components: { @@ -57,7 +58,15 @@ export default defineComponent({ }) .map((modulePart) => { if (modulePart.type === 'link') { - return translate(modulePart); + const link = omit>(modulePart, ['url']); + + if (modulePart.url.startsWith('http')) { + link.href = modulePart.url; + } else { + link.to = modulePart.url; + } + + return translate(link); } const module = registeredModules.value.find((module) => module.id === modulePart.id)!;