diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 2e59e2c0d47..63815bc0cf8 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -553,6 +553,17 @@ export class CallingClass { this.getGroupCall(conversationId)?.requestVideo(resolutions); } + public groupMembersChanged(conversationId: string): void { + // This will be called for any conversation change, so it's likely that there won't + // be a group call available; that's fine. + const groupCall = this.getGroupCall(conversationId); + if (!groupCall) { + return; + } + + groupCall.setGroupMembers(this.getGroupCallMembers(conversationId)); + } + // See the comment in types/Calling.ts to explain why we have to do this conversion. private convertRingRtcConnectionState( connectionState: ConnectionState diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index 336cb9c1b0e..189003e70e2 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable camelcase */ +import { ThunkAction } from 'redux-thunk'; import { difference, fromPairs, @@ -14,6 +15,8 @@ import { without, } from 'lodash'; +import { StateType as RootStateType } from '../reducer'; +import { calling } from '../../services/calling'; import { getOwn } from '../../util/getOwn'; import { trigger } from '../../shims/events'; import { NoopActionType } from './noop'; @@ -454,13 +457,17 @@ function conversationAdded( function conversationChanged( id: string, data: ConversationType -): ConversationChangedActionType { - return { - type: 'CONVERSATION_CHANGED', - payload: { - id, - data, - }, +): ThunkAction { + return dispatch => { + calling.groupMembersChanged(id); + + dispatch({ + type: 'CONVERSATION_CHANGED', + payload: { + id, + data, + }, + }); }; } function conversationRemoved(id: string): ConversationRemovedActionType { diff --git a/ts/test-both/state/ducks/conversations_test.ts b/ts/test-electron/state/ducks/conversations_test.ts similarity index 100% rename from ts/test-both/state/ducks/conversations_test.ts rename to ts/test-electron/state/ducks/conversations_test.ts