mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Tweaks to alias
This commit is contained in:
parent
23e392adc5
commit
e0e3628717
|
|
@ -270,6 +270,7 @@ func createRoom(
|
||||||
var nameEvent *fledglingEvent
|
var nameEvent *fledglingEvent
|
||||||
var topicEvent *fledglingEvent
|
var topicEvent *fledglingEvent
|
||||||
var guestAccessEvent *fledglingEvent
|
var guestAccessEvent *fledglingEvent
|
||||||
|
var aliasEvent *fledglingEvent
|
||||||
|
|
||||||
if r.Name != "" {
|
if r.Name != "" {
|
||||||
nameEvent = &fledglingEvent{
|
nameEvent = &fledglingEvent{
|
||||||
|
|
@ -316,6 +317,13 @@ func createRoom(
|
||||||
if aliasResp.RoomID != "" {
|
if aliasResp.RoomID != "" {
|
||||||
return util.MessageResponse(400, "Alias already exists")
|
return util.MessageResponse(400, "Alias already exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aliasEvent = &fledglingEvent{
|
||||||
|
Type: gomatrixserverlib.MRoomCanonicalAlias,
|
||||||
|
Content: eventutil.CanonicalAlias{
|
||||||
|
Alias: roomAlias,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var initialStateEvents []fledglingEvent
|
var initialStateEvents []fledglingEvent
|
||||||
|
|
@ -377,11 +385,11 @@ func createRoom(
|
||||||
if topicEvent != nil {
|
if topicEvent != nil {
|
||||||
eventsToMake = append(eventsToMake, *topicEvent)
|
eventsToMake = append(eventsToMake, *topicEvent)
|
||||||
}
|
}
|
||||||
if roomAlias != "" {
|
if aliasEvent != nil {
|
||||||
// TODO: bit of a chicken and egg problem here as the alias doesn't exist and cannot until we have made the room.
|
// TODO: bit of a chicken and egg problem here as the alias doesn't exist and cannot until we have made the room.
|
||||||
// This means we might fail creating the alias but say the canonical alias is something that doesn't exist.
|
// This means we might fail creating the alias but say the canonical alias is something that doesn't exist.
|
||||||
// m.room.aliases is handled when we call roomserver.SetRoomAlias
|
// m.room.aliases is handled when we call roomserver.SetRoomAlias
|
||||||
eventsToMake = append(eventsToMake, fledglingEvent{gomatrixserverlib.MRoomCanonicalAlias, "", eventutil.CanonicalAlias{Alias: roomAlias}})
|
eventsToMake = append(eventsToMake, *aliasEvent)
|
||||||
}
|
}
|
||||||
eventsToMake = append(eventsToMake, initialStateEvents...)
|
eventsToMake = append(eventsToMake, initialStateEvents...)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue