@@ -333,15 +333,20 @@ func InitialRoomEvents(roomVer gomatrixserverlib.RoomVersion, creator string) []
333333 Type : "m.room.create" ,
334334 StateKey : b .Ptr ("" ),
335335 Sender : creator ,
336- Content : map [string ]interface {}{
337- "creator" : creator ,
338- "room_version" : roomVer ,
339- // We have to add randomness to the create event, else if you create 2x v12+ rooms in the same millisecond
340- // they will get the same room ID, clobbering internal data structures and causing extremely confusing
341- // behaviour. By adding this entropy, we ensure that even if rooms are created in the same millisecond, their
342- // hashes will not be the same.
343- "complement_entropy" : util .RandomString (18 ),
344- },
336+ Content : func () map [string ]interface {} {
337+ content := map [string ]interface {}{
338+ "room_version" : roomVer ,
339+ // We have to add randomness to the create event, else if you create 2x v12+ rooms in the same millisecond
340+ // they will get the same room ID, clobbering internal data structures and causing extremely confusing
341+ // behaviour. By adding this entropy, we ensure that even if rooms are created in the same millisecond, their
342+ // hashes will not be the same.
343+ "complement_entropy" : util .RandomString (18 ),
344+ }
345+ if gomatrixserverlib .MustGetRoomVersion (gomatrixserverlib .RoomVersion (roomVer )).CreatorInCreateEvent () {
346+ content ["creator" ] = creator
347+ }
348+ return content
349+ }(),
345350 },
346351 {
347352 Type : "m.room.member" ,
0 commit comments