If room_version isn't specified in the m.room.create event, assume room version 1

This commit is contained in:
Neil Alexander 2020-03-09 09:10:01 +00:00
parent e43d8a17ae
commit 1b52775ccd
2 changed files with 6 additions and 2 deletions

View file

@ -72,7 +72,9 @@ func (d *Database) StoreEvent(
} }
} }
roomVersion := strconv.Itoa(int(version.GetDefaultRoomVersion())) // The only room version where the "room_version" key isn't specified is
// room version 1
roomVersion := 1
// The below works because the first event to be persisted to the database // The below works because the first event to be persisted to the database
// is always the m.room.create event. We can therefore set the room version // is always the m.room.create event. We can therefore set the room version
// correctly at the same time as assigning the room NID. // correctly at the same time as assigning the room NID.

View file

@ -93,7 +93,9 @@ func (d *Database) StoreEvent(
} }
} }
roomVersion := strconv.Itoa(int(version.GetDefaultRoomVersion())) // The only room version where the "room_version" key isn't specified is
// room version 1
roomVersion := 1
// The below works because the first event to be persisted to the database // The below works because the first event to be persisted to the database
// is always the m.room.create event. We can therefore set the room version // is always the m.room.create event. We can therefore set the room version
// correctly at the same time as assigning the room NID. // correctly at the same time as assigning the room NID.