Skip to content

Commit

Permalink
Check m.room.create event on room upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed May 28, 2021
1 parent 1b587e2 commit b69e745
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/room-upgrade-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ export class RoomUpgradeHandler {
private async onJoinedNewRoom(oldRoomId: string, newRoomId: string) {
log.debug(`Joined ${newRoomId}`);
const intent = this.bridge.getIntent();
const { predecessor } = await intent.getStateEvent(newRoomId, 'm.room.create');
if (predecessor.room_id !== oldRoomId) {
log.error(
`Room doesn't have a matching predecessor (expected: ${oldRoomId}, got: ${predecessor.room_id}), not bridging.`
);
return false;
}
const asBot = this.bridge.getBot();
if (this.opts.migrateStoreEntries) {
const success = await this.migrateStoreEntries(oldRoomId, newRoomId);
Expand Down

0 comments on commit b69e745

Please sign in to comment.