Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
Closed
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
10 changes: 8 additions & 2 deletions src/server/accessors/ModifyCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class ModifyCreator implements IModifyCreator {
return this.bridges.getLivechatBridge().createMessage(result, this.appId);
}

private _finishRoom(builder: IRoomBuilder): Promise<string> {
private async _finishRoom(builder: IRoomBuilder): Promise<string> {
const result = builder.getRoom();
delete result.id;

Expand All @@ -106,7 +106,13 @@ export class ModifyCreator implements IModifyCreator {

if (result.type !== RoomType.LIVE_CHAT) {
if (!result.creator || !result.creator.id) {
throw new Error('Invalid creator assigned to the room.');
const appUser = await this.bridges.getUserBridge().getAppUser(this.appId);

if (!appUser) {
throw new Error('Invalid creator assigned to the message.');
}

result.creator = appUser;
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/server/accessors/ModifyCreator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class ModifyCreatorTestFixture {
roomBd.setType(RoomType.CHANNEL);
Expect(room.type).toBe(RoomType.CHANNEL);

await Expect(async () => await mc.finish(roomBd)).toThrowErrorAsync(Error, 'Invalid creator assigned to the room.');
await Expect(async () => await mc.finish(roomBd)).not.toThrowErrorAsync(Error, 'Invalid creator assigned to the room.');
roomBd.setCreator(TestData.getUser());
Expect(room.creator).toBeDefined();

Expand Down