mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-30 18:23:09 -06:00
Merge branch 'neilalexander/federationinput2' into neilalexander/federationinput
This commit is contained in:
commit
a3c3a4adcc
|
|
@ -459,7 +459,6 @@ func createRoom(
|
||||||
Kind: roomserverAPI.KindNew,
|
Kind: roomserverAPI.KindNew,
|
||||||
Event: event,
|
Event: event,
|
||||||
Origin: cfg.Matrix.ServerName,
|
Origin: cfg.Matrix.ServerName,
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: roomserverAPI.DoNotSendToOtherServers,
|
SendAsServer: roomserverAPI.DoNotSendToOtherServers,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,6 @@ func SendJoin(
|
||||||
{
|
{
|
||||||
Kind: api.KindNew,
|
Kind: api.KindNew,
|
||||||
Event: event.Headered(stateAndAuthChainResponse.RoomVersion),
|
Event: event.Headered(stateAndAuthChainResponse.RoomVersion),
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: string(cfg.Matrix.ServerName),
|
SendAsServer: string(cfg.Matrix.ServerName),
|
||||||
TransactionID: nil,
|
TransactionID: nil,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,6 @@ func SendLeave(
|
||||||
{
|
{
|
||||||
Kind: api.KindNew,
|
Kind: api.KindNew,
|
||||||
Event: event.Headered(verRes.RoomVersion),
|
Event: event.Headered(verRes.RoomVersion),
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: string(cfg.Matrix.ServerName),
|
SendAsServer: string(cfg.Matrix.ServerName),
|
||||||
TransactionID: nil,
|
TransactionID: nil,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,6 @@ type InputRoomEvent struct {
|
||||||
Event *gomatrixserverlib.HeaderedEvent `json:"event"`
|
Event *gomatrixserverlib.HeaderedEvent `json:"event"`
|
||||||
// Which server told us about this event.
|
// Which server told us about this event.
|
||||||
Origin gomatrixserverlib.ServerName `json:"origin"`
|
Origin gomatrixserverlib.ServerName `json:"origin"`
|
||||||
// List of state event IDs that authenticate this event.
|
|
||||||
// These are likely derived from the "auth_events" JSON key of the event.
|
|
||||||
// But can be different because the "auth_events" key can be incomplete or wrong.
|
|
||||||
// For example many matrix events forget to reference the m.room.create event even though it is needed for auth.
|
|
||||||
// (since synapse allows this to happen we have to allow it as well.)
|
|
||||||
AuthEventIDs []string `json:"auth_event_ids"`
|
|
||||||
// Whether the state is supplied as a list of event IDs or whether it
|
// Whether the state is supplied as a list of event IDs or whether it
|
||||||
// should be derived from the state at the previous events.
|
// should be derived from the state at the previous events.
|
||||||
HasState bool `json:"has_state"`
|
HasState bool `json:"has_state"`
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ func SendEvents(
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Event: event,
|
Event: event,
|
||||||
Origin: origin,
|
Origin: origin,
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: string(sendAsServer),
|
SendAsServer: string(sendAsServer),
|
||||||
TransactionID: txnID,
|
TransactionID: txnID,
|
||||||
}
|
}
|
||||||
|
|
@ -63,10 +62,9 @@ func SendEventWithState(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ires = append(ires, InputRoomEvent{
|
ires = append(ires, InputRoomEvent{
|
||||||
Kind: KindOutlier,
|
Kind: KindOutlier,
|
||||||
Event: outlier.Headered(event.RoomVersion),
|
Event: outlier.Headered(event.RoomVersion),
|
||||||
Origin: origin,
|
Origin: origin,
|
||||||
AuthEventIDs: outlier.AuthEventIDs(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +77,6 @@ func SendEventWithState(
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Event: event,
|
Event: event,
|
||||||
Origin: origin,
|
Origin: origin,
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
HasState: true,
|
HasState: true,
|
||||||
StateEventIDs: stateEventIDs,
|
StateEventIDs: stateEventIDs,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -177,10 +177,9 @@ func (t *missingStateReq) processEventWithMissingState(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
outlierRoomEvents = append(outlierRoomEvents, api.InputRoomEvent{
|
outlierRoomEvents = append(outlierRoomEvents, api.InputRoomEvent{
|
||||||
Kind: api.KindOutlier,
|
Kind: api.KindOutlier,
|
||||||
Event: outlier.Headered(roomVersion),
|
Event: outlier.Headered(roomVersion),
|
||||||
Origin: t.origin,
|
Origin: t.origin,
|
||||||
AuthEventIDs: outlier.AuthEventIDs(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// TODO: we could do this concurrently?
|
// TODO: we could do this concurrently?
|
||||||
|
|
@ -202,7 +201,6 @@ func (t *missingStateReq) processEventWithMissingState(
|
||||||
Kind: api.KindOld,
|
Kind: api.KindOld,
|
||||||
Event: backwardsExtremity.Headered(roomVersion),
|
Event: backwardsExtremity.Headered(roomVersion),
|
||||||
Origin: t.origin,
|
Origin: t.origin,
|
||||||
AuthEventIDs: backwardsExtremity.AuthEventIDs(),
|
|
||||||
HasState: true,
|
HasState: true,
|
||||||
StateEventIDs: stateIDs,
|
StateEventIDs: stateIDs,
|
||||||
SendAsServer: api.DoNotSendToOtherServers,
|
SendAsServer: api.DoNotSendToOtherServers,
|
||||||
|
|
@ -220,7 +218,6 @@ func (t *missingStateReq) processEventWithMissingState(
|
||||||
Kind: api.KindOld,
|
Kind: api.KindOld,
|
||||||
Event: newEvent.Headered(roomVersion),
|
Event: newEvent.Headered(roomVersion),
|
||||||
Origin: t.origin,
|
Origin: t.origin,
|
||||||
AuthEventIDs: newEvent.AuthEventIDs(),
|
|
||||||
SendAsServer: api.DoNotSendToOtherServers,
|
SendAsServer: api.DoNotSendToOtherServers,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ func (r *Inviter) PerformInvite(
|
||||||
Kind: api.KindNew,
|
Kind: api.KindNew,
|
||||||
Event: event,
|
Event: event,
|
||||||
Origin: event.Origin(),
|
Origin: event.Origin(),
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: req.SendAsServer,
|
SendAsServer: req.SendAsServer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,6 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
{
|
{
|
||||||
Kind: rsAPI.KindNew,
|
Kind: rsAPI.KindNew,
|
||||||
Event: event.Headered(buildRes.RoomVersion),
|
Event: event.Headered(buildRes.RoomVersion),
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,6 @@ func (r *Leaver) performLeaveRoomByID(
|
||||||
Kind: api.KindNew,
|
Kind: api.KindNew,
|
||||||
Event: event.Headered(buildRes.RoomVersion),
|
Event: event.Headered(buildRes.RoomVersion),
|
||||||
Origin: event.Origin(),
|
Origin: event.Origin(),
|
||||||
AuthEventIDs: event.AuthEventIDs(),
|
|
||||||
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,9 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
|
// Genuine create events are the only case where it's OK to have no previous state.
|
||||||
|
isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1
|
||||||
|
if result.BeforeStateSnapshotNID == 0 && !isCreate {
|
||||||
return nil, types.MissingEventError(
|
return nil, types.MissingEventError(
|
||||||
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
|
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,9 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
|
// Genuine create events are the only case where it's OK to have no previous state.
|
||||||
|
isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1
|
||||||
|
if result.BeforeStateSnapshotNID == 0 && !isCreate {
|
||||||
return nil, types.MissingEventError(
|
return nil, types.MissingEventError(
|
||||||
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
|
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -643,9 +643,8 @@ func (rc *reqCtx) injectResponseToRoomserver(res *gomatrixserverlib.MSC2836Event
|
||||||
var ires []roomserver.InputRoomEvent
|
var ires []roomserver.InputRoomEvent
|
||||||
for _, outlier := range append(eventsInOrder, messageEvents...) {
|
for _, outlier := range append(eventsInOrder, messageEvents...) {
|
||||||
ires = append(ires, roomserver.InputRoomEvent{
|
ires = append(ires, roomserver.InputRoomEvent{
|
||||||
Kind: roomserver.KindOutlier,
|
Kind: roomserver.KindOutlier,
|
||||||
Event: outlier.Headered(outlier.Version()),
|
Event: outlier.Headered(outlier.Version()),
|
||||||
AuthEventIDs: outlier.AuthEventIDs(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// we've got the data by this point so use a background context
|
// we've got the data by this point so use a background context
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue