Skip to content

Commit

Permalink
Merge branch 'main' into nic/feat/PB-3407-Expanded-view-will-be-shown…
Browse files Browse the repository at this point in the history
…-in-meeting-room
  • Loading branch information
ahmadkadri authored Jul 13, 2023
2 parents 2a019c8 + 9aaeb5e commit 8bbc156
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-foxes-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@nordeck/matrix-meetings-bot': patch
---

Apply the configured room layout when widgets are added or removed.
8 changes: 8 additions & 0 deletions matrix-meetings-bot/src/service/MeetingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,14 @@ export class MeetingService {
}

promises.push(this.cleanupWidgets(widgetIds, room, userContext));
const filteredWidgetIds = widgetIds.filter(
(widget) =>
!widget.startsWith(WidgetType.COCKPIT) &&
!widget.startsWith(WidgetType.BREAKOUT_SESSIONS)
);
promises.push(
this.setUpWidgetLayoutConfiguration(roomId, filteredWidgetIds)
);
await Promise.all(promises);
}
}
Expand Down
52 changes: 52 additions & 0 deletions matrix-meetings-bot/test/MeetingService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,58 @@ describe('test relevant functionality of MeetingService', () => {
callInfo(0, 3, StateEventName.IO_ELEMENT_WIDGETS_LAYOUT_EVENT)
).toStrictEqual(expected);
});

test('update room layout when widgets change', async () => {
// room has a poll widget
// cockpit is there after the meeting room was created
const parentRoom: any = create_test_meeting(
CURRENT_USER,
PARENT_MEETING_ROOM_ID,
null,
['poll', WidgetType.COCKPIT]
);
when(clientMock.getRoomState(PARENT_MEETING_ROOM_ID)).thenResolve(
parentRoom
);

// add jitsi
const widgets = ['jitsi'];
await meetingService.handleWidgets(
userContext,
new MeetingWidgetsHandleDto(parentId, true, widgets)
);

const e = StateEventName.IM_VECTOR_MODULAR_WIDGETS_EVENT;
verify(
clientMock.sendStateEvent(parentId, e, anything(), anything())
).times(2);

expect(callInfo(0, SendStateEventParameter.Content, e).type).toBe(
'net.nordeck.poll'
); // updated poll
expect(callInfo(1, SendStateEventParameter.Content, e).type).toBe(
'jitsi'
); // added jitsi
const expected = {
widgets: {
poll: { container: 'top', index: 0, width: 100, height: 40 },
jitsi: { container: 'right' },
},
};
verify(
clientMock.sendStateEvent(
parentId,
StateEventName.IO_ELEMENT_WIDGETS_LAYOUT_EVENT,
anything(),
anything()
)
).times(1);

// event content
expect(
callInfo(0, 3, StateEventName.IO_ELEMENT_WIDGETS_LAYOUT_EVENT)
).toStrictEqual(expected);
});
});

test('createMeeting without parent with external data', async () => {
Expand Down

0 comments on commit 8bbc156

Please sign in to comment.