Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Router from './router/router.ts'
import BrowserStorage from './services/BrowserStorage.js'
import { EventBus } from './services/EventBus.ts'
import { leaveConversationSync } from './services/participantsService.js'
import { useActorStore } from './stores/actor.ts'
import { useCallViewStore } from './stores/callView.ts'
import { useFederationStore } from './stores/federation.ts'
import { useSidebarStore } from './stores/sidebar.ts'
Expand Down Expand Up @@ -80,6 +81,7 @@ export default {
federationStore: useFederationStore(),
callViewStore: useCallViewStore(),
sidebarStore: useSidebarStore(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -122,7 +124,7 @@ export default {
},

getUserId() {
return this.$store.getters.getUserId()
return this.actorStore.userId
},

isSendingMessages() {
Expand Down Expand Up @@ -323,7 +325,7 @@ export default {

const payload = {
token: params.token,
participantIdentifier: this.$store.getters.getParticipantIdentifier(),
participantIdentifier: this.actorStore.participantIdentifier,
flags,
silent: true,
recordingConsent: this.recordingConsentGiven,
Expand Down Expand Up @@ -372,7 +374,7 @@ export default {
if (!getCurrentUser()) {
// Set the current actor/participant for guests
const conversation = this.$store.getters.conversation(this.token)
this.$store.dispatch('setCurrentParticipant', conversation)
this.actorStore.setCurrentParticipant(conversation)
}
})

Expand Down Expand Up @@ -440,14 +442,6 @@ export default {
})
}
})

if (getCurrentUser()) {
console.debug('Setting current user')
this.$store.dispatch('setCurrentUser', getCurrentUser())
this.$store.dispatch('getCurrentUserTeams')
} else {
console.debug('Can not set current user because it\'s a guest')
}
},

async mounted() {
Expand Down
4 changes: 3 additions & 1 deletion src/FilesSidebarTabApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { getFileConversation } from './services/filesIntegrationServices.js'
import {
leaveConversationSync,
} from './services/participantsService.js'
import { useActorStore } from './stores/actor.ts'
import { checkBrowser } from './utils/browserCheck.ts'
import CancelableRequest from './utils/cancelableRequest.js'
import { signalingKill } from './utils/webrtc/index.js'
Expand All @@ -62,6 +63,7 @@ export default {
setup() {
return {
isLeavingAfterSessionIssue: useSessionIssueHandler(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -142,7 +144,7 @@ export default {
},

beforeMount() {
this.$store.dispatch('setCurrentUser', getCurrentUser())
this.actorStore.setCurrentUser(getCurrentUser())

window.addEventListener('unload', () => {
console.info('Navigating away, leaving conversation')
Expand Down
10 changes: 6 additions & 4 deletions src/PublicShareAuthSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
leaveConversationSync,
setGuestUserName,
} from './services/participantsService.js'
import { useActorStore } from './stores/actor.ts'
import { signalingKill } from './utils/webrtc/index.js'

export default {
Expand All @@ -65,6 +66,7 @@ export default {

return {
isLeavingAfterSessionIssue: useSessionIssueHandler(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -127,9 +129,9 @@ export default {
const guestNickname = getGuestNickname()

if (currentUser) {
this.$store.dispatch('setCurrentUser', currentUser)
this.actorStore.setCurrentUser(currentUser)
} else if (guestNickname) {
this.$store.dispatch('setDisplayName', guestNickname)
this.actorStore.setDisplayName(guestNickname)
} else {
subscribe('talk:guest-name:added', this.showGuestMediaSettings)
}
Expand Down Expand Up @@ -183,12 +185,12 @@ export default {
// Although the current participant is automatically added to
// the participants store it must be explicitly set in the
// actors store.
if (!this.$store.getters.getUserId()) {
if (!this.actorStore.userId) {
// Set the current actor/participant for guests
const conversation = this.$store.getters.conversation(this.token)

// Setting a guest only uses "sessionId" and "participantType".
this.$store.dispatch('setCurrentParticipant', conversation)
this.actorStore.setCurrentParticipant(conversation)
}
} catch (exception) {
window.clearInterval(this.fetchCurrentConversationIntervalId)
Expand Down
8 changes: 5 additions & 3 deletions src/PublicShareSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { getPublicShareConversationData } from './services/filesIntegrationServi
import {
leaveConversationSync,
} from './services/participantsService.js'
import { useActorStore } from './stores/actor.ts'
import { checkBrowser } from './utils/browserCheck.ts'
import { signalingKill } from './utils/webrtc/index.js'

Expand Down Expand Up @@ -97,6 +98,7 @@ export default {
return {
isInCall: useIsInCall(),
isLeavingAfterSessionIssue: useSessionIssueHandler(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -223,7 +225,7 @@ export default {
// signaling server will retry the connection again and again,
// so at some point the anonymous user will have been overriden
// with the current user and the connection will succeed.
this.$store.dispatch('setCurrentUser', {
this.actorStore.setCurrentUser({
uid: data.userId,
displayName: data.displayName,
})
Expand All @@ -241,12 +243,12 @@ export default {
// Although the current participant is automatically added to
// the participants store it must be explicitly set in the
// actors store.
if (!this.$store.getters.getUserId()) {
if (!this.actorStore.userId) {
// Set the current actor/participant for guests
const conversation = this.$store.getters.conversation(this.token)

// Setting a guest only uses "sessionId" and "participantType".
this.$store.dispatch('setCurrentParticipant', conversation)
this.actorStore.setCurrentParticipant(conversation)
}
} catch (exception) {
window.clearInterval(this.fetchCurrentConversationIntervalId)
Expand Down
4 changes: 3 additions & 1 deletion src/components/CallView/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import LocalVideo from '../shared/LocalVideo.vue'
import VideoBottomBar from '../shared/VideoBottomBar.vue'
import VideoVue from '../shared/VideoVue.vue'
import { ATTENDEE, PARTICIPANT } from '../../../constants.ts'
import { useActorStore } from '../../../stores/actor.ts'
import { useCallViewStore } from '../../../stores/callView.ts'
import { placeholderImage, placeholderModel, placeholderName, placeholderSharedData } from './gridPlaceholders.ts'

Expand Down Expand Up @@ -269,6 +270,7 @@ export default {
videosCap,
videosCapEnforced,
callViewStore: useCallViewStore(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -502,7 +504,7 @@ export default {
},

isGuestNonModerator() {
return this.$store.getters.getActorType() === ATTENDEE.ACTOR_TYPE.GUESTS
return this.actorStore.isActorGuest
&& this.$store.getters.conversation(this.token).participantType !== PARTICIPANT.TYPE.GUEST_MODERATOR
},

Expand Down
12 changes: 5 additions & 7 deletions src/components/CallView/shared/LocalVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<AvatarWrapper :id="userId"
:token="token"
:name="displayName"
:source="actorType"
:source="actorStore.actorType"
:size="avatarSize"
:loading="isNotConnected"
disable-menu
Expand Down Expand Up @@ -69,6 +69,7 @@ import AccountOff from 'vue-material-design-icons/AccountOff.vue'
import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
import VideoBackground from './VideoBackground.vue'
import { AVATAR } from '../../../constants.ts'
import { useActorStore } from '../../../stores/actor.ts'
import { useCallViewStore } from '../../../stores/callView.ts'
import attachMediaStream from '../../../utils/attachmediastream.js'
import { ConnectionState } from '../../../utils/webrtc/models/CallParticipantModel.js'
Expand Down Expand Up @@ -158,6 +159,7 @@ export default {
devMode,
screenshotMode,
callViewStore: useCallViewStore(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -208,15 +210,11 @@ export default {
},

userId() {
return this.$store.getters.getUserId()
},

actorType() {
return this.$store.getters.getActorType()
return this.actorStore.userId
},

displayName() {
return this.$store.getters.getDisplayName()
return this.actorStore.displayName
},

avatarSize() {
Expand Down
8 changes: 6 additions & 2 deletions src/components/CallView/shared/ReactionToaster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import usernameToColor from '@nextcloud/vue/functions/usernameToColor'
import Hex from 'crypto-js/enc-hex.js'
import SHA1 from 'crypto-js/sha1.js'
import TransitionWrapper from '../../UIShared/TransitionWrapper.vue'
import { useActorStore } from '../../../stores/actor.ts'
import { useGuestNameStore } from '../../../stores/guestName.js'

const reactions = {
Expand Down Expand Up @@ -86,7 +87,10 @@ export default {

setup() {
const guestNameStore = useGuestNameStore()
return { guestNameStore }
return {
guestNameStore,
actorStore: useActorStore(),
}
},

data() {
Expand Down Expand Up @@ -159,7 +163,7 @@ export default {
reaction,
reactionURL: this.getReactionURL(reaction),
name: isLocalModel
? this.$store.getters.getDisplayName() || t('spreed', 'Guest')
? this.actorStore.displayName || t('spreed', 'Guest')
: this.getParticipantName(model),
seed: Math.random(),
})
Expand Down
5 changes: 4 additions & 1 deletion src/components/CallView/shared/VideoBottomBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import VideoOff from 'vue-material-design-icons/VideoOff.vue'
import VideoBottomBar from './VideoBottomBar.vue'
import { CONVERSATION, PARTICIPANT } from '../../../constants.ts'
import storeConfig from '../../../store/storeConfig.js'
import { useActorStore } from '../../../stores/actor.ts'
import { useCallViewStore } from '../../../stores/callView.ts'
import { findNcButton } from '../../../test-helpers.js'
import { ConnectionState } from '../../../utils/webrtc/models/CallParticipantModel.js'
Expand All @@ -36,6 +37,7 @@ describe('VideoBottomBar.vue', () => {
let testStoreConfig
let componentProps
let conversationProps
let actorStore

const audioIndicatorAriaLabels = [t('spreed', 'Mute'), t('spreed', 'Muted')]
const videoIndicatorAriaLabels = [t('spreed', 'Disable video'), t('spreed', 'Enable video')]
Expand All @@ -47,6 +49,7 @@ describe('VideoBottomBar.vue', () => {
localVue.use(Vuex)
setActivePinia(createPinia())
callViewStore = useCallViewStore()
actorStore = useActorStore()

conversationProps = {
token: TOKEN,
Expand Down Expand Up @@ -83,7 +86,7 @@ describe('VideoBottomBar.vue', () => {

testStoreConfig = cloneDeep(storeConfig)
testStoreConfig.modules.conversationsStore.getters.conversation = jest.fn().mockReturnValue((token) => conversationProps)
testStoreConfig.modules.actorStore.getters.getUserId = jest.fn().mockReturnValue(() => USER_ID)
actorStore.userId = USER_ID
store = new Store(testStoreConfig)
})

Expand Down
4 changes: 3 additions & 1 deletion src/components/CallView/shared/VideoBottomBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import VideoIcon from 'vue-material-design-icons/Video.vue'
import VideoOff from 'vue-material-design-icons/VideoOff.vue'
import TransitionWrapper from '../../UIShared/TransitionWrapper.vue'
import { PARTICIPANT } from '../../../constants.ts'
import { useActorStore } from '../../../stores/actor.ts'
import { useCallViewStore } from '../../../stores/callView.ts'
import { ConnectionState } from '../../../utils/webrtc/models/CallParticipantModel.js'

Expand Down Expand Up @@ -186,6 +187,7 @@ export default {
setup() {
return {
callViewStore: useCallViewStore(),
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -265,7 +267,7 @@ export default {
// Moderator rights
participantType() {
return this.$store.getters.conversation(this.token)?.participantType
|| (this.$store.getters.getUserId() !== null
|| (this.actorStore.isLoggedIn
? PARTICIPANT.TYPE.USER
: PARTICIPANT.TYPE.GUEST)
},
Expand Down
9 changes: 5 additions & 4 deletions src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import TransitionWrapper from './UIShared/TransitionWrapper.vue'
import { CONVERSATION, PARTICIPANT } from '../constants.ts'
import { getTalkConfig } from '../services/CapabilitiesManager.ts'
import { EventBus } from '../services/EventBus.ts'
import { useActorStore } from '../stores/actor.ts'
import { useChatExtrasStore } from '../stores/chatExtras.js'

export default {
Expand Down Expand Up @@ -108,6 +109,7 @@ export default {
provide('chatView:isSidebar', props.isSidebar)
return {
chatExtrasStore: useChatExtrasStore(),
actorStore: useActorStore(),
}
},

Expand All @@ -120,16 +122,15 @@ export default {

computed: {
isGuest() {
return this.$store.getters.isActorGuest()
return this.actorStore.isActorGuest
},

isGuestWithoutDisplayName() {
const userName = this.$store.getters.getDisplayName()
return !userName && this.isGuest
return this.isGuest && !this.actorStore.displayName
},

canUploadFiles() {
return getTalkConfig(this.token, 'attachments', 'allowed') && this.$store.getters.getUserId()
return getTalkConfig(this.token, 'attachments', 'allowed') && this.actorStore.userId
&& this.$store.getters.getAttachmentFolderFreeSpace() !== 0
&& (this.conversation.permissions & PARTICIPANT.PERMISSIONS.CHAT)
&& !this.conversation.remoteServer // no attachments support in federated conversations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ import RecordingConsentSettings from './RecordingConsentSettings.vue'
import SipSettings from './SipSettings.vue'
import { CALL, CONFIG, CONVERSATION, PARTICIPANT } from '../../constants.ts'
import { getTalkConfig, hasTalkFeature } from '../../services/CapabilitiesManager.ts'
import { useActorStore } from '../../stores/actor.ts'
import { useSettingsStore } from '../../stores/settings.js'

const supportsArchive = hasTalkFeature('local', 'archived-conversations-v2')
Expand Down Expand Up @@ -167,6 +168,7 @@ export default {
supportsArchive,
settingsStore,
meetingHeader,
actorStore: useActorStore(),
}
},

Expand Down Expand Up @@ -195,7 +197,7 @@ export default {
},

isGuest() {
return this.$store.getters.isActorGuest()
return this.actorStore.isActorGuest
},

token() {
Expand Down
Loading