Add state key to m.bridge events

This commit is contained in:
Tulir Asokan 2020-06-11 14:41:45 +03:00
parent 47a1d7f6cb
commit b8de8544e1

View file

@ -855,6 +855,7 @@ func (portal *Portal) CreateMatrixRoom(user *User) error {
}, },
}, },
} }
bridgeInfoStateKey := fmt.Sprintf("net.maunium.whatsapp://whatsapp/%s", portal.Key.JID)
initialState := []*event.Event{{ initialState := []*event.Event{{
Type: event.StatePowerLevels, Type: event.StatePowerLevels,
Content: event.Content{ Content: event.Content{
@ -863,10 +864,12 @@ func (portal *Portal) CreateMatrixRoom(user *User) error {
}, { }, {
Type: StateBridgeInfo, Type: StateBridgeInfo,
Content: bridgeInfo, Content: bridgeInfo,
StateKey: &bridgeInfoStateKey,
}, { }, {
// TODO remove this once https://github.com/matrix-org/matrix-doc/pull/2346 is in spec // TODO remove this once https://github.com/matrix-org/matrix-doc/pull/2346 is in spec
Type: StateHalfShotBridgeInfo, Type: StateHalfShotBridgeInfo,
Content: bridgeInfo, Content: bridgeInfo,
StateKey: &bridgeInfoStateKey,
}} }}
if !portal.AvatarURL.IsEmpty() { if !portal.AvatarURL.IsEmpty() {
initialState = append(initialState, &event.Event{ initialState = append(initialState, &event.Event{