mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Expand RoomInfo to cover more DB storage functions (#1377)
* Factor more things to RoomInfo * Factor out remaining bits for RoomInfo * Linting for now
This commit is contained in:
parent
82a9617659
commit
02a73f29f8
14 changed files with 148 additions and 179 deletions
|
@ -18,6 +18,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
@ -239,16 +240,19 @@ func (r *RoomserverInternalAPI) sendUpdatedAliasesEvent(
|
|||
}
|
||||
builder.AuthEvents = refs
|
||||
|
||||
roomVersion, err := r.DB.GetRoomVersionForRoom(ctx, roomID)
|
||||
roomInfo, err := r.DB.RoomInfo(ctx, roomID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if roomInfo == nil {
|
||||
return fmt.Errorf("room %s does not exist", roomID)
|
||||
}
|
||||
|
||||
// Build the event
|
||||
now := time.Now()
|
||||
event, err := builder.Build(
|
||||
now, r.Cfg.Matrix.ServerName, r.Cfg.Matrix.KeyID,
|
||||
r.Cfg.Matrix.PrivateKey, roomVersion,
|
||||
r.Cfg.Matrix.PrivateKey, roomInfo.RoomVersion,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -257,7 +261,7 @@ func (r *RoomserverInternalAPI) sendUpdatedAliasesEvent(
|
|||
// Create the request
|
||||
ire := api.InputRoomEvent{
|
||||
Kind: api.KindNew,
|
||||
Event: event.Headered(roomVersion),
|
||||
Event: event.Headered(roomInfo.RoomVersion),
|
||||
AuthEventIDs: event.AuthEventIDs(),
|
||||
SendAsServer: serverName,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue