Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-11245 ignore conference updates that do not match the active conference #2352

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
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ describe('Conference Reducer', () => {
expect(result.currentConference.caseName).toEqual('Updating conference');
expect(result.currentConference.endpoints[0].pexipInfo).toBeTruthy();
});

it('should ignore the conference if the id does not match the active conference id', () => {
const conferenceWithDifferentId: VHConference = { ...conferenceTestData, id: 'different-id' };
const result = conferenceReducer(
existingInitialState,
ConferenceActions.loadConferenceSuccess({ conference: conferenceWithDifferentId })
);
expect(result).toEqual(existingInitialState);
});
});

describe('leaveConference action', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const updateLoggedInParticipant = (state: ConferenceState, participants: VHParti
export const conferenceReducer = createReducer(
initialState,
on(ConferenceActions.loadConferenceSuccess, (state, { conference }) => {
if (state.currentConference && state.currentConference.id !== conference.id) {
// participants will get updates to other hearings they're booked to on the same day. We only want to update the current conference
// To replace the hearing, dispatch the leaveConference action first
return state;
}
// retain the pexip info and media device status for the participants (this does not come from the API)
const updatedParticipants = conference.participants.map(p => {
const existingParticipant = state.currentConference?.participants.find(cp => cp.id === p.id);
Expand Down
Loading