Skip to content

Commit

Permalink
move guestNameStore initialisation from mixin to components
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Sep 13, 2023
1 parent 3582eb7 commit 7a2e614
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -96,8 +97,11 @@ export default {
setup() {
const { sortParticipants } = useSortParticipants()
// FIXME move to getParticipants when replace with composable
const guestNameStore = useGuestNameStore()
return {
guestNameStore,
sortParticipants,
}
},
Expand Down
10 changes: 10 additions & 0 deletions src/components/TopBar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -213,6 +214,15 @@ export default {
},
},
setup() {
// FIXME move to getParticipants when replace with composable
const guestNameStore = useGuestNameStore()
return {
guestNameStore,
}
},
data: () => {
return {
unreadNotificationHandle: null,
Expand Down
8 changes: 2 additions & 6 deletions src/mixins/getParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,13 @@ 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'

const getParticipants = {

mixins: [isInLobby],

setup() {
const guestNameStore = useGuestNameStore()
return { guestNameStore }
},

data() {
return {
participantsInitialised: false,
Expand Down Expand Up @@ -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])),
Expand Down

0 comments on commit 7a2e614

Please sign in to comment.