Generate m.room.canonical_alias instead of legacy m.room.aliases

This commit is contained in:
Neil Alexander 2021-07-21 13:45:26 +01:00
parent f0f8c7f055
commit e13a76cef8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -73,7 +73,7 @@ func (r *RoomserverInternalAPI) SetRoomAlias(
return err return err
} }
// Send a m.room.aliases event with the updated list of aliases for this room // Send a m.room.canonical_alias event with the updated list of aliases for this room
// At this point we've already committed the alias to the database so we // At this point we've already committed the alias to the database so we
// shouldn't cancel this request. // shouldn't cancel this request.
// TODO: Ensure that we send unsent events when if server restarts. // TODO: Ensure that we send unsent events when if server restarts.
@ -176,7 +176,8 @@ func (r *RoomserverInternalAPI) RemoveRoomAlias(
} }
type roomAliasesContent struct { type roomAliasesContent struct {
Aliases []string `json:"aliases"` Alias string `json:"alias"`
Aliases []string `json:"alt_aliases"`
} }
// Build the updated m.room.aliases event to send to the room after addition or // Build the updated m.room.aliases event to send to the room after addition or
@ -189,7 +190,7 @@ func (r *RoomserverInternalAPI) sendUpdatedAliasesEvent(
builder := gomatrixserverlib.EventBuilder{ builder := gomatrixserverlib.EventBuilder{
Sender: userID, Sender: userID,
RoomID: roomID, RoomID: roomID,
Type: "m.room.aliases", Type: gomatrixserverlib.MRoomCanonicalAlias,
StateKey: &serverName, StateKey: &serverName,
} }
@ -199,7 +200,9 @@ func (r *RoomserverInternalAPI) sendUpdatedAliasesEvent(
if err != nil { if err != nil {
return err return err
} }
content := roomAliasesContent{Aliases: aliases} content := roomAliasesContent{
Aliases: aliases,
}
rawContent, err := json.Marshal(content) rawContent, err := json.Marshal(content)
if err != nil { if err != nil {
return err return err