From 7a2e614725552a2c9148cb7a867fd12b3c4be247 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 13 Sep 2023 11:06:01 +0200 Subject: [PATCH] move guestNameStore initialisation from mixin to components Signed-off-by: Maksim Sukharev --- .../RightSidebar/Participants/ParticipantsTab.vue | 4 ++++ src/components/TopBar/TopBar.vue | 10 ++++++++++ src/mixins/getParticipants.js | 8 ++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 107e32815be..237c2ace042 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -69,6 +69,7 @@ import getParticipants from '../../../mixins/getParticipants.js' import { searchPossibleConversations } from '../../../services/conversationsService.js' import { EventBus } from '../../../services/EventBus.js' import { addParticipant } from '../../../services/participantsService.js' +import { useGuestNameStore } from '../../../stores/guestName.js' import CancelableRequest from '../../../utils/cancelableRequest.js' export default { @@ -96,8 +97,11 @@ export default { setup() { const { sortParticipants } = useSortParticipants() + // FIXME move to getParticipants when replace with composable + const guestNameStore = useGuestNameStore() return { + guestNameStore, sortParticipants, } }, diff --git a/src/components/TopBar/TopBar.vue b/src/components/TopBar/TopBar.vue index efebde3c46b..373a87b8a64 100644 --- a/src/components/TopBar/TopBar.vue +++ b/src/components/TopBar/TopBar.vue @@ -166,6 +166,7 @@ import TopBarMenu from './TopBarMenu.vue' import { CONVERSATION } from '../../constants.js' import getParticipants from '../../mixins/getParticipants.js' import BrowserStorage from '../../services/BrowserStorage.js' +import { useGuestNameStore } from '../../stores/guestName.js' import { getStatusMessage } from '../../utils/userStatus.js' import { localCallParticipantModel, localMediaModel } from '../../utils/webrtc/index.js' @@ -213,6 +214,15 @@ export default { }, }, + setup() { + // FIXME move to getParticipants when replace with composable + const guestNameStore = useGuestNameStore() + + return { + guestNameStore, + } + }, + data: () => { return { unreadNotificationHandle: null, diff --git a/src/mixins/getParticipants.js b/src/mixins/getParticipants.js index ea5df10154c..d7ae961e457 100644 --- a/src/mixins/getParticipants.js +++ b/src/mixins/getParticipants.js @@ -31,7 +31,6 @@ import { emit } from '@nextcloud/event-bus' import { PARTICIPANT } from '../constants.js' import { EventBus } from '../services/EventBus.js' import { fetchParticipants } from '../services/participantsService.js' -import { useGuestNameStore } from '../stores/guestName.js' import CancelableRequest from '../utils/cancelableRequest.js' import isInLobby from './isInLobby.js' @@ -39,11 +38,6 @@ const getParticipants = { mixins: [isInLobby], - setup() { - const guestNameStore = useGuestNameStore() - return { guestNameStore } - }, - data() { return { participantsInitialised: false, @@ -143,6 +137,8 @@ const getParticipants = { }) if (participant.participantType === PARTICIPANT.TYPE.GUEST || participant.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR) { + // FIXME replace mixin with composable. until then + // guestNameStore should be set up at component level this.guestNameStore.addGuestName({ token, actorId: Hex.stringify(SHA1(participant.sessionIds[0])),