Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tmills80 committed Feb 12, 2024
1 parent be0c27e commit 05e5373
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion syncapi/routing/getevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func GetEvent(
}
}

events, err := db.Events(ctx, []string{eventID})
events, err := db.Events(ctx, device, []string{eventID}, rsAPI)
if err != nil {
logger.WithError(err).Error("GetEvent: syncDB.Events failed")
return util.JSONResponse{
Expand Down
3 changes: 1 addition & 2 deletions syncapi/storage/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ type DatabaseTransaction interface {
// Returns a list of events matching the requested IDs found in the database.
// If an event is not found in the database then it will be omitted from the list.
// Returns an error if there was a problem talking with the database.
// Does not include any transaction IDs in the returned events.
Events(ctx context.Context, eventIDs []string) ([]*rstypes.HeaderedEvent, error)
Events(ctx context.Context, device *userapi.Device, eventIDs []string, rsAPI api.SyncRoomserverAPI) ([]*rstypes.HeaderedEvent, error)
// GetStateEvent returns the Matrix state event of a given type for a given room with a given state key
// If no event could be found, returns nil
// If there was an issue during the retrieval, returns an error
Expand Down
5 changes: 2 additions & 3 deletions syncapi/storage/shared/storage_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,15 @@ func (d *DatabaseTransaction) RoomReceiptsAfter(ctx context.Context, roomIDs []s
// Returns a list of events matching the requested IDs found in the database.
// If an event is not found in the database then it will be omitted from the list.
// Returns an error if there was a problem talking with the database.
// Does not include any transaction IDs in the returned events.
func (d *DatabaseTransaction) Events(ctx context.Context, eventIDs []string) ([]*rstypes.HeaderedEvent, error) {
func (d *DatabaseTransaction) Events(ctx context.Context, device *userapi.Device, eventIDs []string, rsAPI api.SyncRoomserverAPI) ([]*rstypes.HeaderedEvent, error) {
streamEvents, err := d.OutputEvents.SelectEvents(ctx, d.txn, eventIDs, nil, false)
if err != nil {
return nil, err
}

// We don't include a device here as we only include transaction IDs in
// incremental syncs.
return d.StreamEventsToEvents(ctx, nil, streamEvents, nil), nil
return d.StreamEventsToEvents(ctx, device, streamEvents, rsAPI), nil
}

func (d *DatabaseTransaction) AllJoinedUsersInRooms(ctx context.Context) (map[string][]string, error) {
Expand Down

0 comments on commit 05e5373

Please sign in to comment.