Browse Source

Merge pull request #15382 from nextcloud/fix/noid/participants-updates

pull/15335/head
Maksim Sukharev 4 months ago
committed by GitHub
parent
commit
2c380efbf5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      src/components/CallView/Grid/Grid.vue
  2. 16
      src/components/RightSidebar/Participants/ParticipantsTab.vue
  3. 44
      src/composables/useGetParticipants.js
  4. 1
      src/store/conversationsStore.js
  5. 3
      src/store/conversationsStore.spec.js

6
src/components/CallView/Grid/Grid.vue

@ -515,10 +515,6 @@ export default {
return this.videos
}
if (!this.participantsInitialised) {
return []
}
const objectMap = {
modelsWithScreenshare: [],
modelsTempPromoted: [],
@ -538,7 +534,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)

16
src/components/RightSidebar/Participants/ParticipantsTab.vue

@ -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.actorStore.userId
},
canAddPhones() {
const canModerateSipDialOut = hasTalkFeature(this.token, 'sip-support-dialout')
&& getTalkConfig(this.token, 'call', 'sip-enabled')
@ -267,9 +263,10 @@ 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.actorStore.userId : user.actorId === this.actorStore.actorId
})
if (!currentUser) {
return
}
@ -277,7 +274,10 @@ export default {
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.actorStore.attendeeId)
if (currentParticipant && this.$store.getters.isModeratorOrUser
&& currentUser.participantPermissions !== currentParticipant?.permissions) {
await this.cancelableGetParticipants()
}
},

44
src/composables/useGetParticipants.js

@ -90,7 +90,7 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
}
const onJoinedConversation = () => {
if (isOneToOneConversation.value) {
if (isOneToOneConversation.value || experimentalUpdateParticipants) {
cancelableGetParticipants()
} else {
nextTick(() => throttleUpdateParticipants())
@ -120,36 +120,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(() => {
@ -158,6 +148,10 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
}
})
watch(token, () => {
cancelPendingUpdates()
})
watch(isActive, (newValue) => {
if (newValue && pendingChanges) {
throttleUpdateParticipants()
@ -165,11 +159,25 @@ export function useGetParticipants(isActive = ref(true), isTopBar = true) {
})
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,
}

1
src/store/conversationsStore.js

@ -324,6 +324,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

3
src/store/conversationsStore.spec.js

@ -107,6 +107,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 },
@ -162,6 +163,7 @@ describe('conversationsStore', () => {
inCall: PARTICIPANT.CALL_FLAG.DISCONNECTED,
lastPing: 600,
participantType: PARTICIPANT.TYPE.USER,
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
sessionIds: [
'session-id-1',
],
@ -194,6 +196,7 @@ describe('conversationsStore', () => {
inCall: PARTICIPANT.CALL_FLAG.DISCONNECTED,
lastPing: 600,
participantType: PARTICIPANT.TYPE.USER,
permissions: PARTICIPANT.PERMISSIONS.CUSTOM,
sessionIds: [
'session-id-1',
],

Loading…
Cancel
Save