mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Fix event federation with pseudoID rooms (#3156)
This commit is contained in:
parent
e216c2fbf0
commit
c809e95335
6 changed files with 24 additions and 8 deletions
|
@ -83,6 +83,7 @@ type Inputer struct {
|
|||
ServerName spec.ServerName
|
||||
SigningIdentity func(ctx context.Context, roomID spec.RoomID, senderID spec.UserID) (fclient.SigningIdentity, error)
|
||||
FSAPI fedapi.RoomserverFederationAPI
|
||||
RSAPI api.RoomserverInternalAPI
|
||||
KeyRing gomatrixserverlib.JSONVerifier
|
||||
ACLs *acls.ServerACLs
|
||||
InputRoomEventTopic string
|
||||
|
|
|
@ -448,6 +448,24 @@ func (r *Inputer) processRoomEvent(
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO: Revist this to ensure we don't replace a current state mxid_mapping with an older one.
|
||||
if event.Version() == gomatrixserverlib.RoomVersionPseudoIDs && event.Type() == spec.MRoomMember {
|
||||
mapping := gomatrixserverlib.MemberContent{}
|
||||
if err = json.Unmarshal(event.Content(), &mapping); err != nil {
|
||||
return err
|
||||
}
|
||||
if mapping.MXIDMapping != nil {
|
||||
storeUserID, userErr := spec.NewUserID(mapping.MXIDMapping.UserID, true)
|
||||
if userErr != nil {
|
||||
return userErr
|
||||
}
|
||||
err = r.RSAPI.StoreUserRoomPublicKey(ctx, mapping.MXIDMapping.UserRoomKey, *storeUserID, *validRoomID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed storing user room public key: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch input.Kind {
|
||||
case api.KindNew:
|
||||
if err = r.updateLatestEvents(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue