Fix ooops

This commit is contained in:
Till Faelligen 2023-03-01 13:56:32 +01:00
parent 51bc5f6559
commit 810bcca7f0
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E
2 changed files with 7 additions and 7 deletions

View file

@ -24,9 +24,10 @@ import (
"fmt"
"time"
"github.com/matrix-org/dendrite/roomserver/internal/helpers"
"github.com/tidwall/gjson"
"github.com/matrix-org/dendrite/roomserver/internal/helpers"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"github.com/opentracing/opentracing-go"
@ -335,9 +336,9 @@ func (r *Inputer) processRoomEvent(
}
if roomInfo == nil {
_, roomInfo, err = r.DB.GetOrCreateRoomNID(ctx, event)
roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, event)
if err != nil {
return fmt.Errorf("r.DB.GetOrCreateRoomNID: %w", err)
return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
}
}
@ -704,9 +705,9 @@ nextAuthEvent:
}
if roomInfo == nil {
_, roomInfo, err = r.DB.GetOrCreateRoomNID(ctx, authEvent)
roomInfo, err = r.DB.GetOrCreateRoomInfo(ctx, authEvent)
if err != nil {
return fmt.Errorf("r.DB.GetOrCreateRoomNID: %w", err)
return fmt.Errorf("r.DB.GetOrCreateRoomInfo: %w", err)
}
}

View file

@ -648,8 +648,7 @@ func (d *Database) IsEventRejected(ctx context.Context, roomNID types.RoomNID, e
return d.EventsTable.SelectEventRejected(ctx, nil, roomNID, eventID)
}
// GetOrCreateRoomNID gets or creates a new roomNID for the given event. Also returns a RoomInfo, which is only safe to use
// with functions only needing a roomVersion or roomNID.
// GetOrCreateRoomInfo gets or creates a new RoomInfo, which is only safe to use with functions only needing a roomVersion or roomNID.
func (d *Database) GetOrCreateRoomInfo(ctx context.Context, event *gomatrixserverlib.Event) (roomInfo *types.RoomInfo, err error) {
// Get the default room version. If the client doesn't supply a room_version
// then we will use our configured default to create the room.