mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Update gmsl to use new validated RoomID on PDUs (#3200)
GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
This commit is contained in:
parent
058081e68e
commit
8245b24100
64 changed files with 241 additions and 413 deletions
|
@ -118,26 +118,23 @@ func ApplyHistoryVisibilityFilter(
|
|||
start := time.Now()
|
||||
|
||||
// try to get the current membership of the user
|
||||
membershipCurrent, _, err := syncDB.SelectMembershipForUser(ctx, events[0].RoomID(), userID.String(), math.MaxInt64)
|
||||
membershipCurrent, _, err := syncDB.SelectMembershipForUser(ctx, events[0].RoomID().String(), userID.String(), math.MaxInt64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get the mapping from eventID -> eventVisibility
|
||||
eventsFiltered := make([]*types.HeaderedEvent, 0, len(events))
|
||||
firstEvRoomID, err := spec.NewRoomID(events[0].RoomID())
|
||||
firstEvRoomID := events[0].RoomID()
|
||||
senderID, err := rsAPI.QuerySenderIDForUser(ctx, firstEvRoomID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
senderID, err := rsAPI.QuerySenderIDForUser(ctx, *firstEvRoomID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
visibilities := visibilityForEvents(ctx, rsAPI, events, senderID, *firstEvRoomID)
|
||||
visibilities := visibilityForEvents(ctx, rsAPI, events, senderID, firstEvRoomID)
|
||||
|
||||
for _, ev := range events {
|
||||
// Validate same room assumption
|
||||
if ev.RoomID() != firstEvRoomID.String() {
|
||||
if ev.RoomID().String() != firstEvRoomID.String() {
|
||||
return nil, fmt.Errorf("events from different rooms supplied to ApplyHistoryVisibilityFilter")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue