Fix 'Invited user can reject invite over federation several times' (#1341)
This commit is contained in:
parent
c60270eea3
commit
55498c8deb
|
@ -139,6 +139,14 @@ func (s *inviteEventsStatements) SelectInviteEventsInRange(
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we have seen this room before, it has a higher stream position and hence takes priority
|
||||||
|
// because the query is ORDER BY id DESC so drop them
|
||||||
|
_, isRetired := retired[roomID]
|
||||||
|
_, isInvited := result[roomID]
|
||||||
|
if isRetired || isInvited {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var event gomatrixserverlib.HeaderedEvent
|
var event gomatrixserverlib.HeaderedEvent
|
||||||
if err := json.Unmarshal(eventJSON, &event); err != nil {
|
if err := json.Unmarshal(eventJSON, &event); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -150,6 +150,14 @@ func (s *inviteEventsStatements) SelectInviteEventsInRange(
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we have seen this room before, it has a higher stream position and hence takes priority
|
||||||
|
// because the query is ORDER BY id DESC so drop them
|
||||||
|
_, isRetired := retired[roomID]
|
||||||
|
_, isInvited := result[roomID]
|
||||||
|
if isRetired || isInvited {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var event gomatrixserverlib.HeaderedEvent
|
var event gomatrixserverlib.HeaderedEvent
|
||||||
if err := json.Unmarshal(eventJSON, &event); err != nil {
|
if err := json.Unmarshal(eventJSON, &event); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -33,7 +33,8 @@ type AccountData interface {
|
||||||
type Invites interface {
|
type Invites interface {
|
||||||
InsertInviteEvent(ctx context.Context, txn *sql.Tx, inviteEvent gomatrixserverlib.HeaderedEvent) (streamPos types.StreamPosition, err error)
|
InsertInviteEvent(ctx context.Context, txn *sql.Tx, inviteEvent gomatrixserverlib.HeaderedEvent) (streamPos types.StreamPosition, err error)
|
||||||
DeleteInviteEvent(ctx context.Context, inviteEventID string) (types.StreamPosition, error)
|
DeleteInviteEvent(ctx context.Context, inviteEventID string) (types.StreamPosition, error)
|
||||||
// SelectInviteEventsInRange returns a map of room ID to invite events.
|
// SelectInviteEventsInRange returns a map of room ID to invite events. If multiple invite/retired invites exist in the given range, return the latest value
|
||||||
|
// for the room.
|
||||||
SelectInviteEventsInRange(ctx context.Context, txn *sql.Tx, targetUserID string, r types.Range) (invites map[string]gomatrixserverlib.HeaderedEvent, retired map[string]gomatrixserverlib.HeaderedEvent, err error)
|
SelectInviteEventsInRange(ctx context.Context, txn *sql.Tx, targetUserID string, r types.Range) (invites map[string]gomatrixserverlib.HeaderedEvent, retired map[string]gomatrixserverlib.HeaderedEvent, err error)
|
||||||
SelectMaxInviteID(ctx context.Context, txn *sql.Tx) (id int64, err error)
|
SelectMaxInviteID(ctx context.Context, txn *sql.Tx) (id int64, err error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,6 +421,7 @@ Remote users may not join unfederated rooms
|
||||||
Non-numeric ports in server names are rejected
|
Non-numeric ports in server names are rejected
|
||||||
Invited user can reject invite over federation
|
Invited user can reject invite over federation
|
||||||
Invited user can reject invite over federation for empty room
|
Invited user can reject invite over federation for empty room
|
||||||
|
Invited user can reject invite over federation several times
|
||||||
Can reject invites over federation for rooms with version 1
|
Can reject invites over federation for rooms with version 1
|
||||||
Can reject invites over federation for rooms with version 2
|
Can reject invites over federation for rooms with version 2
|
||||||
Can reject invites over federation for rooms with version 3
|
Can reject invites over federation for rooms with version 3
|
||||||
|
|
Loading…
Reference in a new issue