From 810bcca7f08393ba2e1a3586269834b4278ad268 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Wed, 1 Mar 2023 13:56:32 +0100 Subject: [PATCH] Fix ooops --- roomserver/internal/input/input_events.go | 11 ++++++----- roomserver/storage/shared/storage.go | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 8d68793cf..ede345a93 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -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) } } diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index f51a7ecf8..be3f228d7 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -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.