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

fix: update meeting name after fetch meetinginfo #342

Merged
merged 3 commits into from
Oct 10, 2024
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
11 changes: 9 additions & 2 deletions src/MeetingsSDKAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,11 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
tap((meeting) => {
const sdkMeeting = this.fetchMeeting(meeting.ID);

this.meetings[meeting.ID] = meeting;
sdkMeeting.emit(EVENT_MEETING_UPDATED, meeting);
this.meetings[meeting.ID] = {
...meeting,
title: sdkMeeting.meetingInfo.topic || meeting.title,
};
sdkMeeting.emit(EVENT_MEETING_UPDATED, this.meetings[meeting.ID]);
}),
catchError((err) => {
logger.error('MEETING', destination, 'createMeeting()', `Unable to create a meeting with "${destination}"`, err);
Expand Down Expand Up @@ -661,6 +664,10 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
}),
}));
} else {
// update the meeting title if available after password verification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we need this code and above now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed from above

if (sdkMeeting.meetingInfo.topic) {
this.updateMeeting(ID, () => ({title: sdkMeeting.meetingInfo.topic}));
}
logger.info('MEETING', ID, 'joinMeeting()', 'Password successfully verified');
}
}
Expand Down
33 changes: 33 additions & 0 deletions src/MeetingsSDKAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,39 @@ describe('Meetings SDK Adapter', () => {
});
});

it('should emit EVENT_MEETING_UPDATED with the updated title from sdkMeeting.meetingInfo.topic', (done) => {
// Mock implementations
meetingsSDKAdapter.getLocalMedia = jest.fn(() => rxjs.of({
localAudio: {
stream: mockSDKMediaStreams.localAudio,
permission: 'ALLOWED',
},
localVideo: {
stream: mockSDKMediaStreams.localVideo,
permission: 'ALLOWED',
},
}));

// Mock fetchMeeting to return an object containing meetingInfo.topic and an emit function
const mockEmit = jest.fn();

meetingsSDKAdapter.fetchMeeting = jest.fn(() => ({
meetingInfo: {
topic: 'Updated Meeting Title',
},
emit: mockEmit,
}));

meetingsSDKAdapter.createMeeting(target).pipe(last()).subscribe(() => {
// Ensure the emit function was called with the updated meeting
expect(mockEmit).toHaveBeenCalledWith('adapter:meeting:updated', expect.objectContaining({
title: 'Updated Meeting Title',
}));

done();
});
});

it('throws error on failed meeting push request', (done) => {
const wrongTarget = 'wrongTarget';
const errorMessage = `Unable to create a meeting "${wrongTarget}"`;
Expand Down