mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
Remove origin
field from PDUs (#2737)
This nukes the `origin` field from PDUs as per matrix-org/matrix-spec#998, matrix-org/gomatrixserverlib#341.
This commit is contained in:
parent
3e87096a21
commit
f022fc1397
11 changed files with 69 additions and 49 deletions
|
@ -50,6 +50,10 @@ func (r *Inviter) PerformInvite(
|
|||
if event.StateKey() == nil {
|
||||
return nil, fmt.Errorf("invite must be a state event")
|
||||
}
|
||||
_, senderDomain, err := gomatrixserverlib.SplitID('@', event.Sender())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("sender %q is invalid", event.Sender())
|
||||
}
|
||||
|
||||
roomID := event.RoomID()
|
||||
targetUserID := *event.StateKey()
|
||||
|
@ -67,7 +71,7 @@ func (r *Inviter) PerformInvite(
|
|||
return nil, nil
|
||||
}
|
||||
isTargetLocal := domain == r.Cfg.Matrix.ServerName
|
||||
isOriginLocal := event.Origin() == r.Cfg.Matrix.ServerName
|
||||
isOriginLocal := senderDomain == r.Cfg.Matrix.ServerName
|
||||
if !isOriginLocal && !isTargetLocal {
|
||||
res.Error = &api.PerformError{
|
||||
Code: api.PerformErrorBadRequest,
|
||||
|
@ -235,7 +239,7 @@ func (r *Inviter) PerformInvite(
|
|||
{
|
||||
Kind: api.KindNew,
|
||||
Event: event,
|
||||
Origin: event.Origin(),
|
||||
Origin: senderDomain,
|
||||
SendAsServer: req.SendAsServer,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue