From bf9182e5cd373561e6bd42a811733239bab10586 Mon Sep 17 00:00:00 2001 From: rsarika <95286093+rsarika@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:08:26 +0530 Subject: [PATCH] fix(MeetingsSdkAdapter): handle joinMeeting with empty password (#340) --- src/MeetingsSDKAdapter.js | 8 ++++++++ src/MeetingsSDKAdapter.test.js | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/MeetingsSDKAdapter.js b/src/MeetingsSDKAdapter.js index 9f84f916..c8149322 100644 --- a/src/MeetingsSDKAdapter.js +++ b/src/MeetingsSDKAdapter.js @@ -635,6 +635,14 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter { const sdkMeeting = this.fetchMeeting(ID); if (sdkMeeting.passwordStatus === 'REQUIRED') { + if (!(options.password || options.hostKey)) { + this.updateMeeting(ID, () => ( + { + passwordRequired: true, + })); + + return; + } const res = await sdkMeeting .verifyPassword(options.hostKey || options.password, options.captcha); diff --git a/src/MeetingsSDKAdapter.test.js b/src/MeetingsSDKAdapter.test.js index a1f69c91..e36a8fa2 100644 --- a/src/MeetingsSDKAdapter.test.js +++ b/src/MeetingsSDKAdapter.test.js @@ -1196,5 +1196,14 @@ describe('Meetings SDK Adapter', () => { expect(mockSDKMeeting.emit.mock.calls[0][0]).toBe('adapter:meeting:updated'); expect(mockSDKMeeting.emit.mock.calls[0][1]).toMatchObject(mockResponse2); }); + + it('joinMeeting with empty password', async () => { + mockSDKMeeting.verifyPassword = jest.fn(); + await meetingsSDKAdapter.joinMeeting(meetingID, {password: ''}); + + expect(mockSDKMeeting.verifyPassword).not.toHaveBeenCalled(); + expect(mockSDKMeeting.emit).toHaveBeenCalledTimes(1); + expect(mockSDKMeeting.join).not.toHaveBeenCalled(); + }); }); });