Remove long deprecated Calls code (#8747)
This commit is contained in:
parent
9e52d794a4
commit
3887ce30a8
13 changed files with 27 additions and 271 deletions
|
|
@ -326,18 +326,6 @@ describe('handleWebSocketEvent', () => {
|
|||
expect(calls.handleCallChannelDisabled).toHaveBeenCalledWith(serverUrl, msg);
|
||||
});
|
||||
|
||||
it('should handle CALLS_USER_CONNECTED event', async () => {
|
||||
msg.event = WebsocketEvents.CALLS_USER_CONNECTED;
|
||||
await handleWebSocketEvent(serverUrl, msg);
|
||||
expect(calls.handleCallUserConnected).toHaveBeenCalledWith(serverUrl, msg);
|
||||
});
|
||||
|
||||
it('should handle CALLS_USER_DISCONNECTED event', async () => {
|
||||
msg.event = WebsocketEvents.CALLS_USER_DISCONNECTED;
|
||||
await handleWebSocketEvent(serverUrl, msg);
|
||||
expect(calls.handleCallUserDisconnected).toHaveBeenCalledWith(serverUrl, msg);
|
||||
});
|
||||
|
||||
it('should handle CALLS_USER_JOINED event', async () => {
|
||||
msg.event = WebsocketEvents.CALLS_USER_JOINED;
|
||||
await handleWebSocketEvent(serverUrl, msg);
|
||||
|
|
@ -416,12 +404,6 @@ describe('handleWebSocketEvent', () => {
|
|||
expect(calls.handleCallUserReacted).toHaveBeenCalledWith(serverUrl, msg);
|
||||
});
|
||||
|
||||
it('should handle CALLS_RECORDING_STATE event', async () => {
|
||||
msg.event = WebsocketEvents.CALLS_RECORDING_STATE;
|
||||
await handleWebSocketEvent(serverUrl, msg);
|
||||
expect(calls.handleCallRecordingState).toHaveBeenCalledWith(serverUrl, msg);
|
||||
});
|
||||
|
||||
it('should handle CALLS_JOB_STATE event', async () => {
|
||||
msg.event = WebsocketEvents.CALLS_JOB_STATE;
|
||||
await handleWebSocketEvent(serverUrl, msg);
|
||||
|
|
|
|||
|
|
@ -178,17 +178,6 @@ export async function handleWebSocketEvent(serverUrl: string, msg: WebSocketMess
|
|||
case WebsocketEvents.CALLS_CHANNEL_DISABLED:
|
||||
calls.handleCallChannelDisabled(serverUrl, msg);
|
||||
break;
|
||||
|
||||
// DEPRECATED in favour of user_joined (since v0.21.0)
|
||||
case WebsocketEvents.CALLS_USER_CONNECTED:
|
||||
calls.handleCallUserConnected(serverUrl, msg);
|
||||
break;
|
||||
|
||||
// DEPRECATED in favour of user_left (since v0.21.0)
|
||||
case WebsocketEvents.CALLS_USER_DISCONNECTED:
|
||||
calls.handleCallUserDisconnected(serverUrl, msg);
|
||||
break;
|
||||
|
||||
case WebsocketEvents.CALLS_USER_JOINED:
|
||||
calls.handleCallUserJoined(serverUrl, msg);
|
||||
break;
|
||||
|
|
@ -228,11 +217,6 @@ export async function handleWebSocketEvent(serverUrl: string, msg: WebSocketMess
|
|||
case WebsocketEvents.CALLS_USER_REACTED:
|
||||
calls.handleCallUserReacted(serverUrl, msg);
|
||||
break;
|
||||
|
||||
// DEPRECATED in favour of CALLS_JOB_STATE (since v2.15.0)
|
||||
case WebsocketEvents.CALLS_RECORDING_STATE:
|
||||
calls.handleCallRecordingState(serverUrl, msg);
|
||||
break;
|
||||
case WebsocketEvents.CALLS_JOB_STATE:
|
||||
calls.handleCallJobState(serverUrl, msg);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -12,13 +12,6 @@ const RequiredServer = {
|
|||
PATCH_VERSION: 0,
|
||||
};
|
||||
|
||||
const MultiSessionCallsVersion = {
|
||||
FULL_VERSION: '0.21.0',
|
||||
MAJOR_VERSION: 0,
|
||||
MIN_VERSION: 21,
|
||||
PATCH_VERSION: 0,
|
||||
};
|
||||
|
||||
const HostControlsCallsVersion = {
|
||||
FULL_VERSION: '0.27.0',
|
||||
MAJOR_VERSION: 0,
|
||||
|
|
@ -59,7 +52,6 @@ const JOB_TYPE_CAPTIONING = 'captioning';
|
|||
export default {
|
||||
RefreshConfigMillis,
|
||||
RequiredServer,
|
||||
MultiSessionCallsVersion,
|
||||
HostControlsCallsVersion,
|
||||
PluginId,
|
||||
REACTION_TIMEOUT,
|
||||
|
|
|
|||
|
|
@ -61,15 +61,9 @@ const WebsocketEvents = {
|
|||
DELETE_TEAM: 'delete_team',
|
||||
RESTORE_TEAM: 'restore_team',
|
||||
APPS_FRAMEWORK_REFRESH_BINDINGS: 'custom_com.mattermost.apps_refresh_bindings',
|
||||
|
||||
CALLS_CHANNEL_ENABLED: `custom_${Calls.PluginId}_channel_enable_voice`,
|
||||
CALLS_CHANNEL_DISABLED: `custom_${Calls.PluginId}_channel_disable_voice`,
|
||||
|
||||
// DEPRECATED in favour of user_joined (since v0.21.0)
|
||||
CALLS_USER_CONNECTED: `custom_${Calls.PluginId}_user_connected`,
|
||||
|
||||
// DEPRECATED in favour of user_left (since v0.21.0)
|
||||
CALLS_USER_DISCONNECTED: `custom_${Calls.PluginId}_user_disconnected`,
|
||||
|
||||
CALLS_USER_JOINED: `custom_${Calls.PluginId}_user_joined`,
|
||||
CALLS_USER_LEFT: `custom_${Calls.PluginId}_user_left`,
|
||||
CALLS_USER_MUTED: `custom_${Calls.PluginId}_user_muted`,
|
||||
|
|
@ -83,9 +77,6 @@ const WebsocketEvents = {
|
|||
CALLS_USER_RAISE_HAND: `custom_${Calls.PluginId}_user_raise_hand`,
|
||||
CALLS_USER_UNRAISE_HAND: `custom_${Calls.PluginId}_user_unraise_hand`,
|
||||
CALLS_USER_REACTED: `custom_${Calls.PluginId}_user_reacted`,
|
||||
|
||||
// DEPRECATED in favour of CALLS_JOB_STATE (since v2.15.0)
|
||||
CALLS_RECORDING_STATE: `custom_${Calls.PluginId}_call_recording_state`,
|
||||
CALLS_JOB_STATE: `custom_${Calls.PluginId}_call_job_state`,
|
||||
CALLS_HOST_CHANGED: `custom_${Calls.PluginId}_call_host_changed`,
|
||||
CALLS_USER_DISMISSED_NOTIFICATION: `custom_${Calls.PluginId}_user_dismissed_notification`,
|
||||
|
|
|
|||
|
|
@ -972,7 +972,14 @@ describe('Actions.Calls', () => {
|
|||
mockClient.getCallForChannel.mockReturnValueOnce({
|
||||
call: {
|
||||
channel_id: 'channel-1',
|
||||
users: ['user-1'],
|
||||
sessions: [
|
||||
{
|
||||
session_id: 'session-1',
|
||||
user_id: 'user-1',
|
||||
unmuted: false,
|
||||
raised_hand: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
enabled: true});
|
||||
const successResult = await CallsActions.loadCallForChannel('server1', 'channel-1');
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import {displayUsername, getUserIdFromChannelName, isSystemAdmin} from '@utils/u
|
|||
|
||||
import {newConnection} from '../connection/connection';
|
||||
|
||||
import type {CallChannelState, CallState, EmojiData, SessionState} from '@mattermost/calls/lib/types';
|
||||
import type {CallChannelState, CallState, EmojiData} from '@mattermost/calls/lib/types';
|
||||
import type {IntlShape} from 'react-intl';
|
||||
|
||||
let connection: CallsConnection | null = null;
|
||||
|
|
@ -94,7 +94,7 @@ export const loadCalls = async (serverUrl: string, userId: string, groupLabel?:
|
|||
|
||||
for (const channel of resp) {
|
||||
if (channel.call) {
|
||||
callsResults[channel.channel_id] = createCallAndAddToIds(channel.channel_id, convertOldCallToNew(channel.call), ids);
|
||||
callsResults[channel.channel_id] = createCallAndAddToIds(channel.channel_id, channel.call, ids);
|
||||
}
|
||||
|
||||
if (typeof channel.enabled !== 'undefined') {
|
||||
|
|
@ -126,7 +126,7 @@ export const loadCallForChannel = async (serverUrl: string, channelId: string) =
|
|||
let call: Call | undefined;
|
||||
const ids = new Set<string>();
|
||||
if (resp.call) {
|
||||
call = createCallAndAddToIds(channelId, convertOldCallToNew(resp.call), ids);
|
||||
call = createCallAndAddToIds(channelId, resp.call, ids);
|
||||
}
|
||||
|
||||
// Batch load user models async because we'll need them later
|
||||
|
|
@ -139,29 +139,6 @@ export const loadCallForChannel = async (serverUrl: string, channelId: string) =
|
|||
return {data: {call, enabled: resp.enabled}};
|
||||
};
|
||||
|
||||
// Converts pre-0.21.0 call to 0.21.0+ call. Can be removed when we stop supporting pre-0.21.0
|
||||
// Also can be removed: all code prefaced with a "Pre v0.21.0, sessionID == userID" comment
|
||||
// Does nothing if the call is in the new format.
|
||||
const convertOldCallToNew = (call: CallState): CallState => {
|
||||
if (call.sessions) {
|
||||
return call;
|
||||
}
|
||||
|
||||
return {
|
||||
...call,
|
||||
sessions: call.users.reduce((accum, cur, curIdx) => {
|
||||
accum.push({
|
||||
session_id: cur,
|
||||
user_id: cur,
|
||||
unmuted: call.states && call.states[curIdx] ? call.states[curIdx].unmuted : false,
|
||||
raised_hand: call.states && call.states[curIdx] ? call.states[curIdx].raised_hand : 0,
|
||||
});
|
||||
return accum;
|
||||
}, [] as SessionState[]),
|
||||
screen_sharing_session_id: call.screen_sharing_id,
|
||||
};
|
||||
};
|
||||
|
||||
export const createCallAndAddToIds = (channelId: string, call: CallState, ids?: Set<string>) => {
|
||||
// Don't cast so that we get alerted to missing types
|
||||
const convertedCall: Call = {
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ import {
|
|||
handleCallScreenOn,
|
||||
handleCallStarted,
|
||||
handleCallState,
|
||||
handleCallUserConnected,
|
||||
handleCallUserDisconnected,
|
||||
handleCallUserJoined,
|
||||
handleCallUserLeft,
|
||||
handleCallUserMuted,
|
||||
|
|
@ -67,8 +65,6 @@ import type {
|
|||
CallStateData,
|
||||
EmptyData,
|
||||
LiveCaptionData,
|
||||
UserConnectedData,
|
||||
UserDisconnectedData,
|
||||
UserDismissedNotification,
|
||||
UserJoinedData,
|
||||
UserLeftData,
|
||||
|
|
@ -114,58 +110,6 @@ describe('websocket event handlers', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('handleCallUserConnected/Disconnected (deprecated)', () => {
|
||||
it('should handle user connected for old version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
version: {version: '0.20.0'},
|
||||
});
|
||||
handleCallUserConnected(serverUrl, {
|
||||
broadcast: {channel_id: channelId},
|
||||
data: {userID: userId},
|
||||
} as WebSocketMessage<UserConnectedData>);
|
||||
expect(fetchUsersByIds).toHaveBeenCalledWith(serverUrl, [userId]);
|
||||
expect(userJoinedCall).toHaveBeenCalledWith(serverUrl, channelId, userId, userId);
|
||||
});
|
||||
|
||||
it('should not handle user connected for new version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
version: {version: '0.21.0'},
|
||||
});
|
||||
handleCallUserConnected(serverUrl, {
|
||||
broadcast: {channel_id: channelId},
|
||||
data: {userID: userId},
|
||||
} as WebSocketMessage<UserConnectedData>);
|
||||
expect(fetchUsersByIds).not.toHaveBeenCalled();
|
||||
expect(userJoinedCall).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should handle user disconnected for old version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
version: {version: '0.20.0'},
|
||||
});
|
||||
handleCallUserDisconnected(serverUrl, {
|
||||
broadcast: {channel_id: channelId},
|
||||
data: {userID: userId},
|
||||
} as WebSocketMessage<UserDisconnectedData>);
|
||||
expect(userLeftCall).toHaveBeenCalledWith(serverUrl, channelId, userId);
|
||||
});
|
||||
|
||||
it('should not handle user disconnected for new version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
version: {version: '0.21.0'},
|
||||
});
|
||||
handleCallUserDisconnected(serverUrl, {
|
||||
broadcast: {channel_id: channelId},
|
||||
data: {userID: userId},
|
||||
} as WebSocketMessage<UserDisconnectedData>);
|
||||
expect(userLeftCall).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleCallUserJoined/Left', () => {
|
||||
it('should handle user joined', () => {
|
||||
handleCallUserJoined(serverUrl, {
|
||||
|
|
@ -314,35 +258,6 @@ describe('websocket event handlers', () => {
|
|||
});
|
||||
|
||||
describe('handleCallUserReacted', () => {
|
||||
it('should handle user reaction for old version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
version: {version: '0.20.0'},
|
||||
});
|
||||
const reactionData = {
|
||||
user_id: userId,
|
||||
session_id: sessionId,
|
||||
reaction: '👍',
|
||||
timestamp: 12345,
|
||||
emoji: {name: 'thumbsup', unified: '1F44D'},
|
||||
};
|
||||
handleCallUserReacted(serverUrl, {
|
||||
event: 'custom_com.mattermost.calls_reaction',
|
||||
seq: 1,
|
||||
broadcast: {
|
||||
omit_users: {} as Dictionary<boolean>,
|
||||
user_id: '',
|
||||
team_id: '',
|
||||
channel_id: channelId,
|
||||
},
|
||||
data: reactionData,
|
||||
} as WebSocketMessage<UserReactionData>);
|
||||
expect(userReacted).toHaveBeenCalledWith(serverUrl, channelId, {
|
||||
...reactionData,
|
||||
session_id: userId,
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle user reaction for new version', () => {
|
||||
jest.mocked(getCallsConfig).mockReturnValue({
|
||||
...DefaultCallsConfig,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {hostRemovedErr} from '@calls/errors';
|
|||
import {
|
||||
callEnded,
|
||||
callStarted,
|
||||
getCallsConfig,
|
||||
getCurrentCall,
|
||||
receivedCaption,
|
||||
removeIncomingCall,
|
||||
|
|
@ -28,24 +27,20 @@ import {
|
|||
userLeftCall,
|
||||
userReacted,
|
||||
} from '@calls/state';
|
||||
import {isMultiSessionSupported} from '@calls/utils';
|
||||
import {WebsocketEvents} from '@constants';
|
||||
import Calls from '@constants/calls';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {getCurrentUserId} from '@queries/servers/system';
|
||||
|
||||
import type {CallRecordingStateData, HostControlsLowerHandMsgData, HostControlsMsgData} from '@calls/types/calls';
|
||||
import type {HostControlsLowerHandMsgData, HostControlsMsgData} from '@calls/types/calls';
|
||||
import type {
|
||||
CallHostChangedData,
|
||||
CallJobState,
|
||||
CallJobStateData,
|
||||
CallStartData,
|
||||
CallState,
|
||||
CallStateData,
|
||||
EmptyData,
|
||||
LiveCaptionData,
|
||||
UserConnectedData,
|
||||
UserDisconnectedData,
|
||||
UserDismissedNotification,
|
||||
UserJoinedData,
|
||||
UserLeftData,
|
||||
|
|
@ -56,29 +51,6 @@ import type {
|
|||
UserVoiceOnOffData,
|
||||
} from '@mattermost/calls/lib/types';
|
||||
|
||||
// DEPRECATED in favour of user_joined (since v0.21.0)
|
||||
export const handleCallUserConnected = (serverUrl: string, msg: WebSocketMessage<UserConnectedData>) => {
|
||||
if (isMultiSessionSupported(getCallsConfig(serverUrl).version)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load user model async (if needed).
|
||||
fetchUsersByIds(serverUrl, [msg.data.userID]);
|
||||
|
||||
// Pre v0.21.0, sessionID == userID
|
||||
userJoinedCall(serverUrl, msg.broadcast.channel_id, msg.data.userID, msg.data.userID);
|
||||
};
|
||||
|
||||
// DEPRECATED in favour of user_left (since v0.21.0)
|
||||
export const handleCallUserDisconnected = (serverUrl: string, msg: WebSocketMessage<UserDisconnectedData>) => {
|
||||
if (isMultiSessionSupported(getCallsConfig(serverUrl).version)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// pre v0.21.0, sessionID == userID
|
||||
userLeftCall(serverUrl, msg.broadcast.channel_id, msg.data.userID);
|
||||
};
|
||||
|
||||
export const handleCallUserJoined = (serverUrl: string, msg: WebSocketMessage<UserJoinedData>) => {
|
||||
// Load user model async (if needed).
|
||||
fetchUsersByIds(serverUrl, [msg.data.user_id]);
|
||||
|
|
@ -91,23 +63,19 @@ export const handleCallUserLeft = (serverUrl: string, msg: WebSocketMessage<User
|
|||
};
|
||||
|
||||
export const handleCallUserMuted = (serverUrl: string, msg: WebSocketMessage<UserMutedUnmutedData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setUserMuted(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, true);
|
||||
setUserMuted(serverUrl, msg.broadcast.channel_id, msg.data.session_id, true);
|
||||
};
|
||||
|
||||
export const handleCallUserUnmuted = (serverUrl: string, msg: WebSocketMessage<UserMutedUnmutedData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setUserMuted(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, false);
|
||||
setUserMuted(serverUrl, msg.broadcast.channel_id, msg.data.session_id, false);
|
||||
};
|
||||
|
||||
export const handleCallUserVoiceOn = (msg: WebSocketMessage<UserVoiceOnOffData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setUserVoiceOn(msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, true);
|
||||
setUserVoiceOn(msg.broadcast.channel_id, msg.data.session_id, true);
|
||||
};
|
||||
|
||||
export const handleCallUserVoiceOff = (msg: WebSocketMessage<UserVoiceOnOffData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setUserVoiceOn(msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, false);
|
||||
setUserVoiceOn(msg.broadcast.channel_id, msg.data.session_id, false);
|
||||
};
|
||||
|
||||
export const handleCallStarted = (serverUrl: string, msg: WebSocketMessage<CallStartData>) => {
|
||||
|
|
@ -141,43 +109,25 @@ export const handleCallChannelDisabled = (serverUrl: string, msg: WebSocketMessa
|
|||
};
|
||||
|
||||
export const handleCallScreenOn = (serverUrl: string, msg: WebSocketMessage<UserScreenOnOffData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setCallScreenOn(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID);
|
||||
setCallScreenOn(serverUrl, msg.broadcast.channel_id, msg.data.session_id);
|
||||
};
|
||||
|
||||
export const handleCallScreenOff = (serverUrl: string, msg: WebSocketMessage<UserScreenOnOffData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setCallScreenOff(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID);
|
||||
setCallScreenOff(serverUrl, msg.broadcast.channel_id, msg.data.session_id);
|
||||
};
|
||||
|
||||
export const handleCallUserRaiseHand = (serverUrl: string, msg: WebSocketMessage<UserRaiseUnraiseHandData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setRaisedHand(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, msg.data.raised_hand);
|
||||
setRaisedHand(serverUrl, msg.broadcast.channel_id, msg.data.session_id, msg.data.raised_hand);
|
||||
};
|
||||
|
||||
export const handleCallUserUnraiseHand = (serverUrl: string, msg: WebSocketMessage<UserRaiseUnraiseHandData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
setRaisedHand(serverUrl, msg.broadcast.channel_id, msg.data.session_id || msg.data.userID, msg.data.raised_hand);
|
||||
setRaisedHand(serverUrl, msg.broadcast.channel_id, msg.data.session_id, msg.data.raised_hand);
|
||||
};
|
||||
|
||||
export const handleCallUserReacted = (serverUrl: string, msg: WebSocketMessage<UserReactionData>) => {
|
||||
// pre v0.21.0, sessionID == userID
|
||||
if (!isMultiSessionSupported(getCallsConfig(serverUrl).version)) {
|
||||
msg.data.session_id = msg.data.user_id;
|
||||
}
|
||||
|
||||
userReacted(serverUrl, msg.broadcast.channel_id, msg.data);
|
||||
};
|
||||
|
||||
// DEPRECATED in favour of handleCallJobState (since v2.15.0)
|
||||
export const handleCallRecordingState = (serverUrl: string, msg: WebSocketMessage<CallRecordingStateData>) => {
|
||||
const jobState: CallJobState = {
|
||||
type: Calls.JOB_TYPE_RECORDING,
|
||||
...msg.data.recState,
|
||||
};
|
||||
setRecordingState(serverUrl, msg.broadcast.channel_id, jobState);
|
||||
};
|
||||
|
||||
export const handleCallJobState = (serverUrl: string, msg: WebSocketMessage<CallJobStateData>) => {
|
||||
switch (msg.data.jobState.type) {
|
||||
case Calls.JOB_TYPE_RECORDING:
|
||||
|
|
|
|||
|
|
@ -219,20 +219,6 @@ export type LiveCaptionMobile = {
|
|||
text: string;
|
||||
}
|
||||
|
||||
// DEPRECATED in favour of CallJobState since v2.16
|
||||
export type CallRecordingState = {
|
||||
init_at: number;
|
||||
start_at: number;
|
||||
end_at: number;
|
||||
err?: string;
|
||||
error_at?: number;
|
||||
}
|
||||
|
||||
export type CallRecordingStateData = {
|
||||
recState: CallRecordingState;
|
||||
callID: string;
|
||||
}
|
||||
|
||||
// TODO: MM-57919, refactor wsmsg data to calls-common
|
||||
export type HostControlsMsgData = {
|
||||
channel_id: string;
|
||||
|
|
|
|||
|
|
@ -372,8 +372,6 @@ describe('makeCallsTheme', () => {
|
|||
describe('isCallsStartedMessage', () => {
|
||||
it('identifies calls notifications', () => {
|
||||
expect(isCallsStartedMessage({sub_type: NOTIFICATION_SUB_TYPE.CALLS} as NotificationData)).toBe(true);
|
||||
expect(isCallsStartedMessage({message: "You've been invited to a call"} as NotificationData)).toBe(true);
|
||||
expect(isCallsStartedMessage({message: '\u200bUser is inviting you to a call'} as NotificationData)).toBe(true);
|
||||
expect(isCallsStartedMessage({message: 'regular message'} as NotificationData)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
@ -423,7 +421,6 @@ describe('getCallPropsFromPost', () => {
|
|||
expect(props.start_at).toBe(0);
|
||||
expect(props.end_at).toBe(0);
|
||||
expect(props.recordings).toStrictEqual({});
|
||||
expect(props.recording_files.length).toBe(0);
|
||||
expect(props.transcriptions).toStrictEqual({});
|
||||
expect(props.participants.length).toBe(0);
|
||||
});
|
||||
|
|
@ -437,7 +434,6 @@ describe('getCallPropsFromPost', () => {
|
|||
expect(props.start_at).toBe(0);
|
||||
expect(props.end_at).toBe(0);
|
||||
expect(props.recordings).toStrictEqual({});
|
||||
expect(props.recording_files.length).toBe(0);
|
||||
expect(props.transcriptions).toStrictEqual({});
|
||||
expect(props.participants.length).toBe(0);
|
||||
});
|
||||
|
|
@ -450,7 +446,6 @@ describe('getCallPropsFromPost', () => {
|
|||
recordings: null,
|
||||
transcriptions: 45,
|
||||
participants: 'invalid',
|
||||
recording_files: 45,
|
||||
};
|
||||
|
||||
const post = TestHelper.fakePost({
|
||||
|
|
@ -463,7 +458,6 @@ describe('getCallPropsFromPost', () => {
|
|||
expect(props.start_at).toBe(0);
|
||||
expect(props.end_at).toBe(0);
|
||||
expect(props.recordings).toStrictEqual({});
|
||||
expect(props.recording_files.length).toBe(0);
|
||||
expect(props.transcriptions).toStrictEqual({});
|
||||
expect(props.participants.length).toBe(0);
|
||||
});
|
||||
|
|
@ -485,7 +479,6 @@ describe('getCallPropsFromPost', () => {
|
|||
tr_id: 'trB',
|
||||
},
|
||||
},
|
||||
recording_files: ['recAFileID', 'recBFileID'],
|
||||
transcriptions: {
|
||||
trA: {
|
||||
file_id: 'trAFileID',
|
||||
|
|
@ -511,7 +504,6 @@ describe('getCallPropsFromPost', () => {
|
|||
expect(props.start_at).toBe(post.props?.start_at);
|
||||
expect(props.end_at).toBe(post.props?.end_at);
|
||||
expect(props.recordings).toBe(post.props?.recordings);
|
||||
expect(props.recording_files).toBe(post.props?.recording_files);
|
||||
expect(props.transcriptions).toBe(post.props?.transcriptions);
|
||||
expect(props.participants).toBe(post.props?.participants);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// See LICENSE.txt for license information.
|
||||
|
||||
import {makeCallsBaseAndBadgeRGB, rgbToCSS} from '@mattermost/calls';
|
||||
import {type CallsConfig, type CallPostProps, isCaption, type Caption, isCallJobMetadata, type CallJobMetadata, type CallsVersionInfo} from '@mattermost/calls/lib/types';
|
||||
import {type CallsConfig, type CallPostProps, isCaption, type Caption, isCallJobMetadata, type CallJobMetadata} from '@mattermost/calls/lib/types';
|
||||
import {Alert} from 'react-native';
|
||||
import {SelectedTrackType, TextTrackType, type ISO639_1, type SelectedTrack, type TextTracks} from 'react-native-video';
|
||||
|
||||
|
|
@ -23,8 +23,6 @@ import type UserModel from '@typings/database/models/servers/user';
|
|||
import type {IntlShape} from 'react-intl';
|
||||
import type {RTCIceServer} from 'react-native-webrtc';
|
||||
|
||||
const callsMessageRegex = /^\u200b.* is inviting you to a call$/;
|
||||
|
||||
export function sortSessions(locale: string, teammateNameDisplay: string, sessions?: Dictionary<CallSession>, presenterID?: string): CallSession[] {
|
||||
if (!sessions) {
|
||||
return [];
|
||||
|
|
@ -95,15 +93,6 @@ export function isSupportedServerCalls(serverVersion?: string) {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function isMultiSessionSupported(callsVersion: CallsVersionInfo) {
|
||||
return isMinimumServerVersion(
|
||||
callsVersion.version,
|
||||
Calls.MultiSessionCallsVersion.MAJOR_VERSION,
|
||||
Calls.MultiSessionCallsVersion.MIN_VERSION,
|
||||
Calls.MultiSessionCallsVersion.PATCH_VERSION,
|
||||
);
|
||||
}
|
||||
|
||||
export function isHostControlsAllowed(config: CallsConfigState) {
|
||||
return Boolean(config.HostControlsAllowed);
|
||||
}
|
||||
|
|
@ -208,13 +197,7 @@ export function fillUserModels(sessions: Dictionary<CallSession>, models: UserMo
|
|||
}
|
||||
|
||||
export function isCallsStartedMessage(payload?: NotificationData) {
|
||||
if (payload?.sub_type === NOTIFICATION_SUB_TYPE.CALLS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// MM-55506 - Remove once we can assume MM servers will be >= 9.3.0, mobile will be >= 2.11.0,
|
||||
// calls will be >= 0.21.0, and push proxy will be >= 5.27.0
|
||||
return (payload?.message === 'You\'ve been invited to a call' || callsMessageRegex.test(payload?.message || ''));
|
||||
return payload?.sub_type === NOTIFICATION_SUB_TYPE.CALLS;
|
||||
}
|
||||
|
||||
export const hasCaptions = (postProps?: Record<string, unknown>): boolean => {
|
||||
|
|
@ -255,8 +238,5 @@ export function getCallPropsFromPost(post: PostModel | Post): CallPostProps {
|
|||
recordings: isRecordOf<CallJobMetadata>(post.props?.recordings, isCallJobMetadata) ? post.props.recordings : {},
|
||||
transcriptions: isRecordOf<CallJobMetadata>(post.props?.transcriptions, isCallJobMetadata) ? post.props.transcriptions : {},
|
||||
participants: isStringArray(post.props?.participants) ? post.props.participants : [],
|
||||
|
||||
// DEPRECATED
|
||||
recording_files: isStringArray(post.props?.recording_files) ? post.props.recording_files : [],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -17,7 +17,7 @@
|
|||
"@formatjs/intl-numberformat": "8.15.4",
|
||||
"@formatjs/intl-pluralrules": "5.4.4",
|
||||
"@gorhom/bottom-sheet": "5.1.2",
|
||||
"@mattermost/calls": "github:mattermost/calls-common#02b04117fcec88f158d3d9ba62546d8d942ed647",
|
||||
"@mattermost/calls": "github:mattermost/calls-common#e2607dcd3abde43ccffa2a77e843172dc0347712",
|
||||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.6.1",
|
||||
|
|
@ -4821,8 +4821,8 @@
|
|||
"node_modules/@mattermost/calls": {
|
||||
"name": "@mattermost/calls-common",
|
||||
"version": "0.27.2",
|
||||
"resolved": "git+ssh://git@github.com/mattermost/calls-common.git#02b04117fcec88f158d3d9ba62546d8d942ed647",
|
||||
"integrity": "sha512-jHlw8b8k0LrOyAzh/6cSnTg3GHL3yJEZhtNhjvvfEnmxso2CzproEX7juzATtMy0Z1NXOLgdBrn/M0naPxJqgA==",
|
||||
"resolved": "git+ssh://git@github.com/mattermost/calls-common.git#e2607dcd3abde43ccffa2a77e843172dc0347712",
|
||||
"integrity": "sha512-1kpY6qz5T8FH8E7vTUeoqL5zVYKEHRZebnJx8Ob3c/HqfbunwVZvHicors9R/6sLMH26uVZQaLcUY90PJzxLUg==",
|
||||
"dependencies": {
|
||||
"@msgpack/msgpack": "3.0.0-beta2",
|
||||
"fflate": "0.8.2",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"@formatjs/intl-numberformat": "8.15.4",
|
||||
"@formatjs/intl-pluralrules": "5.4.4",
|
||||
"@gorhom/bottom-sheet": "5.1.2",
|
||||
"@mattermost/calls": "github:mattermost/calls-common#02b04117fcec88f158d3d9ba62546d8d942ed647",
|
||||
"@mattermost/calls": "github:mattermost/calls-common#e2607dcd3abde43ccffa2a77e843172dc0347712",
|
||||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.6.1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue