チャットリンクの挙動を改善

This commit is contained in:
syuilo 2020-11-03 10:43:50 +09:00
parent 1852d1cc6f
commit 582768a5e4
3 changed files with 20 additions and 24 deletions

View File

@ -11,6 +11,7 @@ import * as os from '@/os';
import copyToClipboard from '@/scripts/copy-to-clipboard'; import copyToClipboard from '@/scripts/copy-to-clipboard';
import { router } from '@/router'; import { router } from '@/router';
import { deckmode, url } from '@/config'; import { deckmode, url } from '@/config';
import { popout } from '@/scripts/popout';
export default defineComponent({ export default defineComponent({
inject: { inject: {
@ -87,11 +88,23 @@ export default defineComponent({
}], e); }], e);
}, },
window() {
os.pageWindow(this.to);
},
popout() {
popout(this.to);
},
nav() { 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) {
if (this.behavior === 'window') { if (this.behavior === 'window') {
os.pageWindow(this.to); return this.window();
return;
} }
} }
@ -99,12 +112,10 @@ export default defineComponent({
this.navHook(this.to); this.navHook(this.to);
} else { } else {
if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') { if (this.$store.state.device.defaultSideView && this.sideViewHook && this.to !== '/') {
this.sideViewHook(this.to); return this.sideViewHook(this.to);
return;
} }
if (this.$store.state.device.deckNavWindow && deckmode && this.to !== '/') { if (this.$store.state.device.deckNavWindow && deckmode && this.to !== '/') {
os.pageWindow(this.to); return this.window();
return;
} }
this.$router.push(this.to); this.$router.push(this.to);

View File

@ -131,16 +131,10 @@ export function getUserMenu(user) {
os.post({ specified: user }); os.post({ specified: user });
} }
}, store.state.i.id != user.id ? { }, store.state.i.id != user.id ? {
type: 'link',
icon: faComments, icon: faComments,
text: i18n.global.t('startMessaging'), text: i18n.global.t('startMessaging'),
action: () => { to: '/my/messaging/' + getAcct(user),
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; }
}
}
} : undefined, null, { } : undefined, null, {
icon: faListUl, icon: faListUl,
text: i18n.global.t('addToList'), text: i18n.global.t('addToList'),

View File

@ -4,9 +4,6 @@ import { computed } from 'vue';
import { store } from '@/store'; import { store } from '@/store';
import { deckmode } from '@/config'; import { deckmode } from '@/config';
import { search } from '@/scripts/search'; import { search } from '@/scripts/search';
import { popout } from '@/scripts/popout';
import { router } from '@/router';
import * as os from '@/os';
export const sidebarDef = { export const sidebarDef = {
notifications: { notifications: {
@ -21,13 +18,7 @@ export const sidebarDef = {
icon: faComments, icon: faComments,
show: computed(() => store.getters.isSignedIn), show: computed(() => store.getters.isSignedIn),
indicated: computed(() => store.getters.isSignedIn && store.state.i.hasUnreadMessagingMessage), indicated: computed(() => store.getters.isSignedIn && store.state.i.hasUnreadMessagingMessage),
action: () => { to: '/my/messaging',
switch (store.state.device.chatOpenBehavior) {
case 'window': { os.pageWindow('/my/messaging'); break; }
case 'popout': { popout('/my/messaging'); break; }
default: { router.push('/my/messaging'); break; }
}
}
}, },
drive: { drive: {
title: 'drive', title: 'drive',