mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 21:12:45 +00:00
Get room versions from database (#918)
* Retrieve room version where known in roomserver * Get room versions in alias code * Increase gocyclothreshold to 13, since we hit that number a lot * Remove gocyclo nolint from StoreEvent * Update interface to get room version from room ID instead of NID * Remove new API * Fixed this query for SQLite but not for Postgres
This commit is contained in:
parent
1467cc10d8
commit
c2bd0b97b3
11 changed files with 68 additions and 45 deletions
|
@ -72,6 +72,10 @@ type RoomEventDatabase interface {
|
|||
ctx context.Context, transactionID string,
|
||||
sessionID int64, userID string,
|
||||
) (string, error)
|
||||
// Look up the room version for a given room.
|
||||
GetRoomVersionForRoom(
|
||||
ctx context.Context, roomID string,
|
||||
) (gomatrixserverlib.RoomVersion, error)
|
||||
}
|
||||
|
||||
// OutputRoomEventWriter has the APIs needed to write an event to the output logs.
|
||||
|
|
|
@ -253,8 +253,10 @@ func (u *latestEventsUpdater) makeOutputNewRoomEvent() (*api.OutputEvent, error)
|
|||
latestEventIDs[i] = u.latest[i].EventID
|
||||
}
|
||||
|
||||
// TODO: Room version here
|
||||
roomVersion := gomatrixserverlib.RoomVersionV1
|
||||
roomVersion, err := u.db.GetRoomVersionForRoom(u.ctx, u.event.RoomID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ore := api.OutputNewRoomEvent{
|
||||
Event: u.event.Headered(roomVersion),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue