Skip to content

Commit

Permalink
regression: old omnichannel rooms only being migrated after their dat…
Browse files Browse the repository at this point in the history
…a is loaded by the client, causing it to not have the ContactId available
  • Loading branch information
pierre-lehnen-rc authored and dougfabris committed Nov 29, 2024
1 parent 5b4ed31 commit ac9e63c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/meteor/app/livechat/server/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { callbacks } from '../../../lib/callbacks';
import { beforeLeaveRoomCallback } from '../../../lib/callbacks/beforeLeaveRoomCallback';
import { i18n } from '../../../server/lib/i18n';
import { roomCoordinator } from '../../../server/lib/rooms/roomCoordinator';
import { maybeMigrateLivechatRoom } from '../../api/server/lib/maybeMigrateLivechatRoom';
import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission';
import { notifyOnUserChange } from '../../lib/server/lib/notifyListener';
import { settings } from '../../settings/server';
Expand All @@ -21,7 +22,11 @@ import './roomAccessValidator.internalService';
const logger = new Logger('LivechatStartup');

Meteor.startup(async () => {
roomCoordinator.setRoomFind('l', (_id) => LivechatRooms.findOneById(_id));
roomCoordinator.setRoomFind('l', async (_id) => {
const room = await LivechatRooms.findOneById(_id);

return (await maybeMigrateLivechatRoom(room)) ?? undefined;
});

beforeLeaveRoomCallback.add(
(user, room) => {
Expand Down

0 comments on commit ac9e63c

Please sign in to comment.