From a74daa0a8a6e7a8cbe16fc456e384b4a98a25340 Mon Sep 17 00:00:00 2001 From: ALC Consulting Date: Tue, 4 Apr 2023 12:22:56 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=9C=A8(front)=20manage=20chat=20use?= =?UTF-8?q?r=20useParticipantsStore=20on=20disconnect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/VideoInfoBar/index.spec.tsx | 7 +++++++ .../live/common/LiveVideoPanel/index.spec.tsx | 2 ++ .../components/live/common/ViewersList/index.spec.tsx | 11 +++++++++++ .../components/live/common/ViewersList/utils.spec.ts | 4 ++++ .../src/hooks/useParticipantsStore/index.spec.tsx | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/src/frontend/packages/lib_video/src/components/common/VideoInfoBar/index.spec.tsx b/src/frontend/packages/lib_video/src/components/common/VideoInfoBar/index.spec.tsx index adc54fdf51..25bcfdb1b9 100644 --- a/src/frontend/packages/lib_video/src/components/common/VideoInfoBar/index.spec.tsx +++ b/src/frontend/packages/lib_video/src/components/common/VideoInfoBar/index.spec.tsx @@ -39,24 +39,28 @@ describe('', () => { participants: [ { id: 'id-anonymous', + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, name: 'my anonymous name', }, { id: 'id-anonymous-2', + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: true, name: 'my anonymous name 2', }, { id: 'id-named', + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, name: 'my name', }, { id: 'id-instructor', + userJid: 'userJid-anonymous', isInstructor: true, isOnStage: true, name: 'my instructor', @@ -260,16 +264,19 @@ describe('', () => { participants: [ { ...mockParticipant, + userJid: 'userJid-anonymous', isInstructor: true, isOnStage: false, }, { ...mockParticipant, + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: true, }, { ...mockParticipant, + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, }, diff --git a/src/frontend/packages/lib_video/src/components/live/common/LiveVideoPanel/index.spec.tsx b/src/frontend/packages/lib_video/src/components/live/common/LiveVideoPanel/index.spec.tsx index 62def23abd..da7f4661bb 100644 --- a/src/frontend/packages/lib_video/src/components/live/common/LiveVideoPanel/index.spec.tsx +++ b/src/frontend/packages/lib_video/src/components/live/common/LiveVideoPanel/index.spec.tsx @@ -113,6 +113,7 @@ describe('', () => { participants: [ { ...mockParticipant, + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, }, @@ -154,6 +155,7 @@ describe('', () => { participants: [ { ...mockParticipant, + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, }, diff --git a/src/frontend/packages/lib_video/src/components/live/common/ViewersList/index.spec.tsx b/src/frontend/packages/lib_video/src/components/live/common/ViewersList/index.spec.tsx index b6f9625ce7..1f67820d2d 100644 --- a/src/frontend/packages/lib_video/src/components/live/common/ViewersList/index.spec.tsx +++ b/src/frontend/packages/lib_video/src/components/live/common/ViewersList/index.spec.tsx @@ -32,18 +32,21 @@ const mockedParticipantOnStage2 = participantMockFactory(); const mockedParticipantOnStage1Full = { ...mockedParticipantOnStage1, + userJid: 'userJid-stage1', isInstructor: false, isOnStage: true, }; const mockedParticipantOnStage2Full = { ...mockedParticipantOnStage2, + userJid: 'userJid-stage2', isInstructor: false, isOnStage: true, }; const participant1 = { id: 'example.jid.student1@prosody.org', + userJid: 'userJid-student1', isInstructor: true, isOnStage: false, name: 'Student 1', @@ -51,6 +54,7 @@ const participant1 = { const participant2 = { id: 'example.jid.student2@prosody.org', + userJid: 'userJid-student2', isInstructor: false, isOnStage: false, name: 'Student 2', @@ -58,6 +62,7 @@ const participant2 = { const participant3 = { id: 'example.jid.student3@prosody.org', + userJid: 'userJid-student3', isInstructor: false, isOnStage: false, name: 'Student 3', @@ -230,12 +235,14 @@ describe(' when user is an instructor', () => { participants: [ { id: 'id-anonymous', + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, name: anonymousName, }, { id: 'id-named', + userJid: 'userJid-anonymous', isInstructor: false, isOnStage: false, name: 'my name', @@ -269,6 +276,7 @@ describe(' when user is a student', () => { act(() => useParticipantsStore.getState().addParticipant({ id: 'example.jid.instructor@prosody.org', + userJid: 'userJid-instructor', isInstructor: true, isOnStage: true, name: 'Instructor', @@ -279,6 +287,7 @@ describe(' when user is a student', () => { act(() => useParticipantsStore.getState().addParticipant({ id: 'example.jid.student1@prosody.org', + userJid: 'userJid-student1', isInstructor: false, isOnStage: false, name: 'Student 1', @@ -289,6 +298,7 @@ describe(' when user is a student', () => { act(() => useParticipantsStore.getState().addParticipant({ id: 'example.jid.student2@prosody.org', + userJid: 'userJid-student2', isInstructor: false, isOnStage: false, name: 'Student 2', @@ -304,6 +314,7 @@ describe(' when user is a student', () => { act(() => useParticipantsStore.getState().addParticipant({ id: 'example.jid.student2@prosody.org', + userJid: 'userJid-student2', isInstructor: false, isOnStage: false, name: 'Student 2', diff --git a/src/frontend/packages/lib_video/src/components/live/common/ViewersList/utils.spec.ts b/src/frontend/packages/lib_video/src/components/live/common/ViewersList/utils.spec.ts index e3dcaf4027..cdc57ac320 100644 --- a/src/frontend/packages/lib_video/src/components/live/common/ViewersList/utils.spec.ts +++ b/src/frontend/packages/lib_video/src/components/live/common/ViewersList/utils.spec.ts @@ -12,24 +12,28 @@ describe('sortParticipantNotOnStage', () => { it('sorts participants', () => { const anonymous1: ParticipantType = { id: 'id1', + userJid: 'userJid-id1', name: generateAnonymousNickname(), isInstructor: false, isOnStage: false, }; const anonymous2: ParticipantType = { id: 'id2', + userJid: 'userJid-id2', name: generateAnonymousNickname(), isInstructor: false, isOnStage: false, }; const registered1: ParticipantType = { id: 'id3', + userJid: 'userJid-id3', name: 'John Wick', isInstructor: false, isOnStage: false, }; const registered2: ParticipantType = { id: 'id4', + userJid: 'userJid-id4', name: 'Jack Sparrow', isInstructor: false, isOnStage: false, diff --git a/src/frontend/packages/lib_video/src/hooks/useParticipantsStore/index.spec.tsx b/src/frontend/packages/lib_video/src/hooks/useParticipantsStore/index.spec.tsx index 7fe707db44..c559eb63dd 100644 --- a/src/frontend/packages/lib_video/src/hooks/useParticipantsStore/index.spec.tsx +++ b/src/frontend/packages/lib_video/src/hooks/useParticipantsStore/index.spec.tsx @@ -2,6 +2,7 @@ import { useParticipantsStore } from '.'; const participant1 = { id: 'example.jid.instructor1@prosody.org', + userJid: 'userJid-instructor1', isInstructor: true, isOnStage: true, name: 'Instructor 1', @@ -9,6 +10,7 @@ const participant1 = { const participant2 = { id: 'example.jid.instructor2@prosody.org', + userJid: 'userJid-instructor2', isInstructor: true, isOnStage: true, name: 'Instructor 2', @@ -16,6 +18,7 @@ const participant2 = { const participant3 = { id: 'example.jid.student1@prosody.org', + userJid: 'userJid-student1', isInstructor: false, isOnStage: true, name: 'Student 1', @@ -23,6 +26,7 @@ const participant3 = { const participant4 = { id: 'example.jid.student2@prosody.org', + userJid: 'userJid-student2', isInstructor: false, isOnStage: false, name: 'Student 2', @@ -30,6 +34,7 @@ const participant4 = { const sameIdParticipant1 = { id: 'example.jid.instructor1@prosody.org', + userJid: 'userJid-instructor1', isInstructor: false, isOnStage: false, name: 'Generic participant', @@ -37,6 +42,7 @@ const sameIdParticipant1 = { const sameNameParticipant1 = { id: 'example.jid.generic@prosody.org', + userJid: 'userJid-generic', isInstructor: false, isOnStage: false, name: 'Instructor 1',