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
6 changes: 1 addition & 5 deletions src/components/CallView/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,6 @@ export default {
return this.videos
}

if (!this.participantsInitialised) {
return []
}

const objectMap = {
modelsWithScreenshare: [],
modelsTempPromoted: [],
Expand All @@ -536,7 +532,7 @@ export default {
objectMap.modelsTempPromoted.push(model)
} else if (this.isModelWithVideo(model)) {
videoTilesMap.set(model.attributes.nextcloudSessionId, model)
} else if (this.isModelWithAudio(model)) {
} else if (this.participantsInitialised && this.isModelWithAudio(model)) {
audioTilesMap.set(model.attributes.nextcloudSessionId, model)
} else {
objectMap.modelsWithNoPermissions.push(model)
Expand Down
16 changes: 8 additions & 8 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ export default {
return [CONVERSATION.TYPE.ONE_TO_ONE, CONVERSATION.TYPE.ONE_TO_ONE_FORMER].includes(this.conversation.type)
},

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

canAddPhones() {
const canModerateSipDialOut = hasTalkFeature(this.token, 'sip-support-dialout')
&& getTalkConfig(this.token, 'call', 'sip-enabled')
Expand Down Expand Up @@ -267,17 +263,21 @@ export default {

methods: {
t,
async updateUsers(usersList) {
const currentUser = usersList.flat().find((user) => user.userId === this.userId)
const currentParticipant = this.participants.find((user) => user.userId === this.userId)
async updateUsers([users]) {
const currentUser = users.find((user) => {
return user.userId ? user.userId === this.$store.getters.getUserId() : user.actorId === this.$store.getters.getActorId()
})
if (!currentUser) {
return
}
// refresh conversation, if current user permissions have been changed
if (currentUser.participantPermissions !== this.conversation.permissions) {
await this.$store.dispatch('fetchConversation', { token: this.token })
}
if (currentUser.participantPermissions !== currentParticipant?.permissions) {

const currentParticipant = this.$store.getters.getParticipant(this.token, this.$store.getters.getAttendeeId())
if (currentParticipant && this.$store.getters.isModeratorOrUser
&& currentUser.participantPermissions !== currentParticipant?.permissions) {
await this.cancelableGetParticipants()
}
},
Expand Down
44 changes: 26 additions & 18 deletions src/composables/useGetParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
}

const onJoinedConversation = () => {
if (isOneToOneConversation.value) {
if (isOneToOneConversation.value || experimentalUpdateParticipants) {
cancelableGetParticipants()
} else {
nextTick(() => throttleUpdateParticipants())
Expand Down Expand Up @@ -119,36 +119,26 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
}

fetchingParticipants = true

// Cancel the parallel request queue to not fetch twice
clearTimeout(throttleFastUpdateTimeout)
throttleFastUpdateTimeout = null
clearTimeout(throttleSlowUpdateTimeout)
throttleSlowUpdateTimeout = null
clearTimeout(throttleLongUpdateTimeout)
throttleLongUpdateTimeout = null
cancelPendingUpdates()

await store.dispatch('fetchParticipants', { token: token.value })
fetchingParticipants = false
}

const throttleFastUpdate = () => {
if (throttleFastUpdateTimeout) {
return
if (!fetchingParticipants && !throttleFastUpdateTimeout) {
throttleFastUpdateTimeout = setTimeout(cancelableGetParticipants, 3_000)
}
throttleFastUpdateTimeout = setTimeout(cancelableGetParticipants, 3_000)
}
const throttleSlowUpdate = () => {
if (throttleSlowUpdateTimeout) {
return
if (!fetchingParticipants && !throttleSlowUpdateTimeout) {
throttleSlowUpdateTimeout = setTimeout(cancelableGetParticipants, 15_000)
}
throttleSlowUpdateTimeout = setTimeout(cancelableGetParticipants, 15_000)
}
const throttleLongUpdate = () => {
if (throttleLongUpdateTimeout) {
return
if (!fetchingParticipants && !throttleLongUpdateTimeout) {
throttleLongUpdateTimeout = setTimeout(cancelableGetParticipants, 60_000)
}
throttleLongUpdateTimeout = setTimeout(cancelableGetParticipants, 60_000)
}

onMounted(() => {
Expand All @@ -157,18 +147,36 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
}
})

watch(token, () => {
cancelPendingUpdates()
})

watch(isActive, (newValue) => {
if (newValue && pendingChanges) {
throttleUpdateParticipants()
}
})

onBeforeUnmount(() => {
cancelPendingUpdates()
if (isTopBar) {
stopGetParticipants()
}
})

/**
* Cancel scheduled participant list updates
* Applies to all parallel queues to not fetch twice
*/
function cancelPendingUpdates() {
clearTimeout(throttleFastUpdateTimeout)
throttleFastUpdateTimeout = null
clearTimeout(throttleSlowUpdateTimeout)
throttleSlowUpdateTimeout = null
clearTimeout(throttleLongUpdateTimeout)
throttleLongUpdateTimeout = null
}

return {
cancelableGetParticipants,
}
Expand Down
1 change: 1 addition & 0 deletions src/store/conversationsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ const actions = {
lastPing: conversation.lastPing,
sessionIds: [conversation.sessionId],
participantType: conversation.participantType,
permissions: conversation.permissions,
attendeeId: conversation.attendeeId,
actorType: conversation.actorType,
actorId: conversation.actorId, // FIXME check public share page handling
Expand Down
3 changes: 3 additions & 0 deletions src/store/conversationsStore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('conversationsStore', () => {
attendeeId: 'attendee-id-1',
actorType: ATTENDEE.ACTOR_TYPE.USERS,
actorId: 'actor-id',
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
defaultPermissions: PARTICIPANT.PERMISSIONS.CUSTOM,
callPermissions: PARTICIPANT.PERMISSIONS.CUSTOM,
lastMessage: { ...previousLastMessage },
Expand Down Expand Up @@ -159,6 +160,7 @@ describe('conversationsStore', () => {
inCall: PARTICIPANT.CALL_FLAG.DISCONNECTED,
lastPing: 600,
participantType: PARTICIPANT.TYPE.USER,
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
sessionIds: [
'session-id-1',
],
Expand Down Expand Up @@ -191,6 +193,7 @@ describe('conversationsStore', () => {
inCall: PARTICIPANT.CALL_FLAG.DISCONNECTED,
lastPing: 600,
participantType: PARTICIPANT.TYPE.USER,
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
sessionIds: [
'session-id-1',
],
Expand Down
Loading