aboutsummaryrefslogtreecommitdiff
path: root/roomserver
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-09-28 07:36:57 +0200
committerGitHub <noreply@github.com>2023-09-28 07:36:57 +0200
commitf02d998253a6fb2b4e4563f7bd66ac5f00aa97f9 (patch)
tree1a63dc59bba25b5bd2904301c2c59161b5913001 /roomserver
parent10b4fbc66d4dca20faa6cc56a272d5303871094b (diff)
Remove the creator field when upgrading to v11 (#3210)
Minor oversight
Diffstat (limited to 'roomserver')
-rw-r--r--roomserver/internal/perform/perform_upgrade.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/roomserver/internal/perform/perform_upgrade.go b/roomserver/internal/perform/perform_upgrade.go
index c32e10d5..9d7c7b56 100644
--- a/roomserver/internal/perform/perform_upgrade.go
+++ b/roomserver/internal/perform/perform_upgrade.go
@@ -368,7 +368,16 @@ func (r *Upgrader) generateInitialEvents(ctx context.Context, oldRoom *api.Query
// in the create event (such as for the room types MSC).
newCreateContent := map[string]interface{}{}
_ = json.Unmarshal(oldCreateEvent.Content(), &newCreateContent)
- newCreateContent["creator"] = string(senderID)
+
+ switch newVersion {
+ case gomatrixserverlib.RoomVersionV11:
+ // RoomVersionV11 removed the creator field from the create content: https://github.com/matrix-org/matrix-spec-proposals/pull/2175
+ // So if we are upgrading from pre v11, we need to remove the field.
+ delete(newCreateContent, "creator")
+ default:
+ newCreateContent["creator"] = senderID
+ }
+
newCreateContent["room_version"] = newVersion
newCreateContent["predecessor"] = gomatrixserverlib.PreviousRoom{
EventID: tombstoneEvent.EventID(),