mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Handle create events better
This commit is contained in:
parent
61437d6e44
commit
4253eccfb3
3 changed files with 3 additions and 5 deletions
|
@ -150,9 +150,7 @@ func (r *Queryer) QueryMissingAuthPrevEvents(
|
||||||
|
|
||||||
for _, prevEventID := range request.PrevEventIDs {
|
for _, prevEventID := range request.PrevEventIDs {
|
||||||
if state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID}); err != nil || len(state) == 0 {
|
if state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID}); err != nil || len(state) == 0 {
|
||||||
if state[0].EventTypeNID != types.MRoomCreateNID {
|
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
|
||||||
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if result.BeforeStateSnapshotNID == 0 {
|
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
|
||||||
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,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if result.BeforeStateSnapshotNID == 0 {
|
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
|
||||||
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),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue