diff --git a/matrix-meetings-bot/src/IEventContentParams.ts b/matrix-meetings-bot/src/IEventContentParams.ts index de4d9b57..10bf9eba 100644 --- a/matrix-meetings-bot/src/IEventContentParams.ts +++ b/matrix-meetings-bot/src/IEventContentParams.ts @@ -15,7 +15,6 @@ */ import { base32 } from 'rfc4648'; -import { v4 as uuiv4 } from 'uuid'; export interface IEventContentParams { room_id?: string; @@ -32,13 +31,16 @@ class EventContentParamsHelper { const base32RoomId = roomId ? base32.stringify(Buffer.from(roomId), { pad: false }) : undefined; + const base32AsUuid = roomId + ? base32.stringify(Buffer.from(roomId), { pad: true }).slice(0, 25) + : undefined; const nonNullTitle = title || ''; return { room_id: roomId, base32_room_id: base32RoomId, title: nonNullTitle, - uuid: uuiv4(), + uuid: base32AsUuid, }; } } diff --git a/matrix-meetings-bot/src/client/WidgetClient.ts b/matrix-meetings-bot/src/client/WidgetClient.ts index 86e0ce23..58c2b0d6 100644 --- a/matrix-meetings-bot/src/client/WidgetClient.ts +++ b/matrix-meetings-bot/src/client/WidgetClient.ts @@ -134,7 +134,6 @@ export class WidgetClient { roomTitle: string | undefined, widgetId: string, eventContent: IWidgetContent | undefined, - widgetStateKey?: string, ): Promise { if (!this.isCustomConfiguredWidget(widgetId)) return; @@ -167,14 +166,12 @@ export class WidgetClient { ); if (!_.isEqual(eventContent, newEventContent)) { - if (widgetStateKey !== 'etherpad') { - await this.client.sendStateEvent( - roomId, - StateEventName.IM_VECTOR_MODULAR_WIDGETS_EVENT, - widgetId, - newEventContent, - ); - } + await this.client.sendStateEvent( + roomId, + StateEventName.IM_VECTOR_MODULAR_WIDGETS_EVENT, + widgetId, + newEventContent, + ); } } diff --git a/matrix-meetings-bot/src/service/MeetingService.ts b/matrix-meetings-bot/src/service/MeetingService.ts index 7803fb2a..b16fa238 100644 --- a/matrix-meetings-bot/src/service/MeetingService.ts +++ b/matrix-meetings-bot/src/service/MeetingService.ts @@ -450,7 +450,6 @@ export class MeetingService { newMeeting.title, widgetId, widgetEventContent, - room.widgetEventById(widgetId)?.state_key, ), ); } @@ -601,7 +600,6 @@ export class MeetingService { room.meeting.title, widgetId, widgetEventContent, - room.widgetEventById(widgetId)?.state_key, ), ); } diff --git a/matrix-meetings-bot/test/MeetingService.test.ts b/matrix-meetings-bot/test/MeetingService.test.ts index 1338e9b2..969c71bf 100644 --- a/matrix-meetings-bot/test/MeetingService.test.ts +++ b/matrix-meetings-bot/test/MeetingService.test.ts @@ -1771,7 +1771,7 @@ describe('test relevant functionality of MeetingService', () => { const e = StateEventName.IM_VECTOR_MODULAR_WIDGETS_EVENT; verify( clientMock.sendStateEvent(parentId, e, anything(), anything()), - ).times(3); + ).times(4); expect(callInfo(0, SendStateEventParameter.Content, e).type).toBe( WidgetType.COCKPIT, @@ -1779,12 +1779,15 @@ describe('test relevant functionality of MeetingService', () => { expect(callInfo(1, SendStateEventParameter.Content, e).type).toBe( 'net.nordeck.poll', ); // updated poll + expect(callInfo(2, SendStateEventParameter.Content, e).type).toBe( + 'm.etherpad', + ); // updated etherpad // verify removed whiteboard - expect(callInfo(2, SendStateEventParameter.StateKey, e)).toBe( + expect(callInfo(3, SendStateEventParameter.StateKey, e)).toBe( 'whiteboard', ); - expect(callInfo(2, SendStateEventParameter.Content, e)).toStrictEqual({}); + expect(callInfo(3, SendStateEventParameter.Content, e)).toStrictEqual({}); }); test('no layout config', async () => {