diff --git a/roomserver/api/wrapper.go b/roomserver/api/wrapper.go index 344e9b079..965f8511f 100644 --- a/roomserver/api/wrapper.go +++ b/roomserver/api/wrapper.go @@ -51,7 +51,7 @@ func SendEventWithState( origin gomatrixserverlib.ServerName, haveEventIDs map[string]bool, async bool, ) error { outliers := state.Events(event.RoomVersion) - ires := make([]InputRoomEvent, 0, len(outliers)) + ires := make([]InputRoomEvent, 0, len(outliers)+1) for _, outlier := range outliers { if haveEventIDs[outlier.EventID()] { continue diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 9d560e915..797341dcd 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -137,7 +137,7 @@ func (r *Inputer) processRoomEvent( return fmt.Errorf("r.DB.RoomInfo: %w", rerr) } isCreateEvent := event.Type() == gomatrixserverlib.MRoomCreate && event.StateKeyEquals("") - if !isCreateEvent && (roomInfo == nil || roomInfo.IsStub()) { + if roomInfo == nil && !isCreateEvent { return fmt.Errorf("room %s does not exist for event %s", event.RoomID(), event.EventID()) } diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index afb6c3494..0211f6737 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -157,7 +157,7 @@ func (d *Database) RoomInfo(ctx context.Context, roomID string) (*types.RoomInfo func (d *Database) roomInfo(ctx context.Context, txn *sql.Tx, roomID string) (*types.RoomInfo, error) { roomInfo, ok := d.Cache.GetRoomInfo(roomID) - if ok && roomInfo != nil && !roomInfo.IsStub() { + if ok && roomInfo != nil && !roomInfo.IsStub() && roomInfo.RoomNID != 0 { // The data that's in the cache is not stubby, so return it. return roomInfo, nil }