Skip to content

Commit

Permalink
Merge pull request #330 from matrix-org/hs/fix-room-upgrade
Browse files Browse the repository at this point in the history
Check m.room.create event on room upgrade
  • Loading branch information
Half-Shot authored Jun 2, 2021
2 parents a5163ae + ab9b853 commit 70d0847
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/330.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix an issue where the room upgrade handler would not check the `m.room.create` event when traversing an upgrade.
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 70d0847

Please sign in to comment.