From 582768a5e49edcdb95a61d5cb9e35363d2e5697e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Nov 2020 10:43:50 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=83=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=81=AE=E6=8C=99=E5=8B=95=E3=82=92=E6=94=B9?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/ui/a.vue | 23 +++++++++++++++++------ src/client/scripts/get-user-menu.ts | 10 ++-------- src/client/sidebar.ts | 11 +---------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/client/components/ui/a.vue b/src/client/components/ui/a.vue index 98f921254..516cf02bd 100644 --- a/src/client/components/ui/a.vue +++ b/src/client/components/ui/a.vue @@ -11,6 +11,7 @@ import * as os from '@/os'; import copyToClipboard from '@/scripts/copy-to-clipboard'; import { router } from '@/router'; import { deckmode, url } from '@/config'; +import { popout } from '@/scripts/popout'; export default defineComponent({ inject: { @@ -87,11 +88,23 @@ export default defineComponent({ }], e); }, + window() { + os.pageWindow(this.to); + }, + + popout() { + popout(this.to); + }, + nav() { + if (this.to.startsWith('/my/messaging')) { + if (this.$store.state.device.chatOpenBehavior === 'window') return this.window(); + if (this.$store.state.device.chatOpenBehavior === 'popout') return this.popout(); + } + if (this.behavior) { if (this.behavior === 'window') { - os.pageWindow(this.to); - return; + return this.window(); } } @@ -99,12 +112,10 @@ export default defineComponent({ this.navHook(this.to); } else { if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') { - this.sideViewHook(this.to); - return; + return this.sideViewHook(this.to); } if (this.$store.state.device.deckNavWindow && deckmode && this.to !== '/') { - os.pageWindow(this.to); - return; + return this.window(); } this.$router.push(this.to); diff --git a/src/client/scripts/get-user-menu.ts b/src/client/scripts/get-user-menu.ts index 72ae9c1e7..693e573b0 100644 --- a/src/client/scripts/get-user-menu.ts +++ b/src/client/scripts/get-user-menu.ts @@ -131,16 +131,10 @@ export function getUserMenu(user) { os.post({ specified: user }); } }, store.state.i.id != user.id ? { + type: 'link', icon: faComments, text: i18n.global.t('startMessaging'), - action: () => { - const acct = getAcct(user); - switch (store.state.device.chatOpenBehavior) { - case 'window': { os.pageWindow('/my/messaging/' + acct); break; } - case 'popout': { popout('/my/messaging'); break; } - default: { router.push('/my/messaging'); break; } - } - } + to: '/my/messaging/' + getAcct(user), } : undefined, null, { icon: faListUl, text: i18n.global.t('addToList'), diff --git a/src/client/sidebar.ts b/src/client/sidebar.ts index af1f68b0d..4b7acb0a6 100644 --- a/src/client/sidebar.ts +++ b/src/client/sidebar.ts @@ -4,9 +4,6 @@ import { computed } from 'vue'; import { store } from '@/store'; import { deckmode } from '@/config'; import { search } from '@/scripts/search'; -import { popout } from '@/scripts/popout'; -import { router } from '@/router'; -import * as os from '@/os'; export const sidebarDef = { notifications: { @@ -21,13 +18,7 @@ export const sidebarDef = { icon: faComments, show: computed(() => store.getters.isSignedIn), indicated: computed(() => store.getters.isSignedIn && store.state.i.hasUnreadMessagingMessage), - action: () => { - switch (store.state.device.chatOpenBehavior) { - case 'window': { os.pageWindow('/my/messaging'); break; } - case 'popout': { popout('/my/messaging'); break; } - default: { router.push('/my/messaging'); break; } - } - } + to: '/my/messaging', }, drive: { title: 'drive',