diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2021-07-09 17:49:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-09 17:49:59 +0100 |
commit | acec6fa979a754c41fa83f7d887bfaf55946e17b (patch) | |
tree | 81f8c423d2dfb5bce62cad477f2e234eca1d9274 /roomserver/internal/query/query.go | |
parent | 1ed732cc783e079feeaf637e23120b027fb7d70b (diff) |
Move a couple of callers to helpers.IsServerCurrentlyInRoom over to the query API (#1912)
Diffstat (limited to 'roomserver/internal/query/query.go')
-rw-r--r-- | roomserver/internal/query/query.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/roomserver/internal/query/query.go b/roomserver/internal/query/query.go index ccd09372..4af0e639 100644 --- a/roomserver/internal/query/query.go +++ b/roomserver/internal/query/query.go @@ -388,10 +388,16 @@ func (r *Queryer) QueryServerAllowedToSeeEvent( return } roomID := events[0].RoomID() - isServerInRoom, err := helpers.IsServerCurrentlyInRoom(ctx, r.DB, request.ServerName, roomID) - if err != nil { - return + + inRoomReq := &api.QueryServerJoinedToRoomRequest{ + RoomID: roomID, + ServerName: request.ServerName, } + inRoomRes := &api.QueryServerJoinedToRoomResponse{} + if err = r.QueryServerJoinedToRoom(ctx, inRoomReq, inRoomRes); err != nil { + return fmt.Errorf("r.Queryer.QueryServerJoinedToRoom: %w", err) + } + info, err := r.DB.RoomInfo(ctx, roomID) if err != nil { return err @@ -400,7 +406,7 @@ func (r *Queryer) QueryServerAllowedToSeeEvent( return fmt.Errorf("QueryServerAllowedToSeeEvent: no room info for room %s", roomID) } response.AllowedToSeeEvent, err = helpers.CheckServerAllowedToSeeEvent( - ctx, r.DB, *info, request.EventID, request.ServerName, isServerInRoom, + ctx, r.DB, *info, request.EventID, request.ServerName, inRoomRes.IsInRoom, ) return } |