diff --git a/server/websocket.go b/server/websocket.go index 0db7f698b..15812b210 100644 --- a/server/websocket.go +++ b/server/websocket.go @@ -31,7 +31,7 @@ const ( wsEventUserVideoOff = "user_video_off" wsEventCallStart = "call_start" wsEventCallState = "call_state" - wsEventCallEnd = "call_ended" + wsEventCallEnd = "call_end" wsEventUserRaiseHand = "user_raise_hand" wsEventUserUnraiseHand = "user_unraise_hand" wsEventUserReacted = "user_reacted" diff --git a/server/websocket_test.go b/server/websocket_test.go index 8a8706110..aac3d7050 100644 --- a/server/websocket_test.go +++ b/server/websocket_test.go @@ -903,7 +903,7 @@ func TestHandleJoin(t *testing.T) { mockAPI.On("PublishWebSocketEvent", wsEventUserLeft, map[string]any{"session_id": connID, "user_id": userID}, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Once() - // Last participant leaving triggers the call_ended broadcast. + // Last participant leaving triggers the call_end broadcast. mockMetrics.On("IncWebSocketEvent", "out", wsEventCallEnd).Once() mockAPI.On("PublishWebSocketEvent", wsEventCallEnd, map[string]any{}, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Once() @@ -1042,7 +1042,7 @@ func TestHandleJoin(t *testing.T) { mockAPI.On("PublishWebSocketEvent", wsEventUserLeft, mock.Anything, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Times(10) - // Last participant leaving triggers the call_ended broadcast. + // Last participant leaving triggers the call_end broadcast. mockMetrics.On("IncWebSocketEvent", "out", wsEventCallEnd).Once() mockAPI.On("PublishWebSocketEvent", wsEventCallEnd, map[string]any{}, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Once() @@ -1388,7 +1388,7 @@ func TestHandleJoin(t *testing.T) { mockAPI.On("PublishWebSocketEvent", wsEventUserLeft, map[string]any{"session_id": connID, "user_id": userID}, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Once() - // Last participant leaving triggers the call_ended broadcast. + // Last participant leaving triggers the call_end broadcast. mockMetrics.On("IncWebSocketEvent", "out", wsEventCallEnd).Once() mockAPI.On("PublishWebSocketEvent", wsEventCallEnd, map[string]any{}, &model.WebsocketBroadcast{ChannelId: channelID, ReliableClusterSend: true}).Once() diff --git a/standalone/src/index.ts b/standalone/src/index.ts index 0d2a143c0..daf9a5b82 100644 --- a/standalone/src/index.ts +++ b/standalone/src/index.ts @@ -298,7 +298,7 @@ export default async function initialiseEmbedApp(cfg: InitConfig) { case `custom_${pluginId}_call_start`: handleCallStart(store, ev as WebSocketMessage); break; - case `custom_${pluginId}_call_ended`: + case `custom_${pluginId}_call_end`: handleCallEnd(store, ev as WebSocketMessage); break; case `custom_${pluginId}_user_joined`: diff --git a/webapp/src/index.tsx b/webapp/src/index.tsx index b59c6b842..34dff249b 100644 --- a/webapp/src/index.tsx +++ b/webapp/src/index.tsx @@ -221,7 +221,7 @@ export default class Plugin { handleCallStart(store, ev); }); - registry.registerWebSocketEventHandler(`custom_${pluginId}_call_ended`, (ev) => { + registry.registerWebSocketEventHandler(`custom_${pluginId}_call_end`, (ev) => { handleCallEnd(store, ev); }); diff --git a/webapp/src/reducers.ts b/webapp/src/reducers.ts index 014fd6727..d4e0ac013 100644 --- a/webapp/src/reducers.ts +++ b/webapp/src/reducers.ts @@ -8,7 +8,7 @@ import {combineReducers} from 'redux'; import {MAX_NUM_REACTIONS_IN_REACTION_STREAM} from 'src/constants'; import {reducer as screenSharingIDs} from 'src/state/screen_sharing_ids/reducer'; import { - CALL_ENDED, + CALL_END, UN_INITIALIZED, USER_JOINED, USER_LEFT, @@ -129,7 +129,7 @@ const clientStateReducer = (state: clientState = null, action: clientStateAction } return state; } - case CALL_ENDED: { + case CALL_END: { const data = action.data as callEndData; if (data.channelID === state?.channelID) { return null; @@ -400,7 +400,7 @@ const calls = (state: callsState = {}, action: callStateAction) => { ...action.data, }, }; - case CALL_ENDED: { + case CALL_END: { const nextState = {...state}; delete nextState[action.data.channelID]; return nextState; @@ -440,7 +440,7 @@ const hosts = (state: hostsState = {}, action: hostsStateAction) => { }, }; } - case CALL_ENDED: { + case CALL_END: { const nextState = {...state}; delete nextState[action.data.channelID]; return nextState; @@ -585,7 +585,7 @@ const recentlyJoinedUsers = (state: recentlyJoinedUsersState = {}, action: recen ...state, [action.data.channelID]: state[action.data.channelID]?.filter((val) => val !== action.data.userID), }; - case CALL_ENDED: + case CALL_END: return { ...state, [action.data.channelID]: [], @@ -663,7 +663,7 @@ const didRingForCalls = (state: { [callID: string]: boolean } = {}, action: Ring [action.data.callID]: true, }; } - case CALL_ENDED: { + case CALL_END: { const nextState = {...state}; delete nextState[action.data.callID]; return nextState; diff --git a/webapp/src/state/screen_sharing_ids/reducer.ts b/webapp/src/state/screen_sharing_ids/reducer.ts index d4e5a8e1e..e1a9ce9fc 100644 --- a/webapp/src/state/screen_sharing_ids/reducer.ts +++ b/webapp/src/state/screen_sharing_ids/reducer.ts @@ -3,7 +3,7 @@ import {UserSessionState} from '@mattermost/calls-common/lib/types'; import {Reducer} from 'redux'; -import {CALL_ENDED, UN_INITIALIZED, USER_LEFT} from 'src/state/session/action_types'; +import {CALL_END, UN_INITIALIZED, USER_LEFT} from 'src/state/session/action_types'; import {USER_SCREEN_OFF, USER_SCREEN_ON} from './action_types'; import {Actions} from './actions'; @@ -59,7 +59,7 @@ export const reducer: Reducer = (initialState = emptyState, acti return nextState; } - case CALL_ENDED: { + case CALL_END: { const nextState = {...initialState}; delete nextState[action.data.channelID]; diff --git a/webapp/src/state/session/action_types.ts b/webapp/src/state/session/action_types.ts index deb6749e9..a0fd18b1e 100644 --- a/webapp/src/state/session/action_types.ts +++ b/webapp/src/state/session/action_types.ts @@ -14,5 +14,5 @@ export const USER_HAND_LOWERED = `${pluginId}_user_hand_lowered` as const; export const USER_REACTED = `${pluginId}_user_reacted` as const; export const USER_REACTED_TIMEOUT = `${pluginId}_user_reacted_timeout` as const; export const USER_LEFT = `${pluginId}_user_left` as const; -export const CALL_ENDED = `${pluginId}_call_ended` as const; +export const CALL_END = `${pluginId}_call_end` as const; diff --git a/webapp/src/state/session/actions.ts b/webapp/src/state/session/actions.ts index 13663471d..a4f3569ea 100644 --- a/webapp/src/state/session/actions.ts +++ b/webapp/src/state/session/actions.ts @@ -6,7 +6,7 @@ import {Channel} from '@mattermost/types/channels'; import {UserProfile} from '@mattermost/types/users'; import { - CALL_ENDED, + CALL_END, SESSIONS_RECEIVED, UN_INITIALIZED, USER_HAND_LOWERED, @@ -130,7 +130,7 @@ export const userLeft = (channelID: Channel['id'], sessionID: string, userID: Us export type ActionUserLeft = ReturnType export const callEnded = (channelID: Channel['id'], callID: string) => ({ - type: CALL_ENDED, + type: CALL_END, data: { channelID, callID, diff --git a/webapp/src/state/session/reducer.ts b/webapp/src/state/session/reducer.ts index cf75fb99f..03451506e 100644 --- a/webapp/src/state/session/reducer.ts +++ b/webapp/src/state/session/reducer.ts @@ -6,7 +6,7 @@ import {Channel} from '@mattermost/types/channels'; import {Reducer} from 'redux'; import { - CALL_ENDED, + CALL_END, SESSIONS_RECEIVED, UN_INITIALIZED, USER_HAND_LOWERED, @@ -233,7 +233,7 @@ export const reducer: Reducer = (initialState = emptyState, acti }; } - case CALL_ENDED: { + case CALL_END: { const nextState = {...initialState}; delete nextState[action.data.channelID];