mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Merge branch 'master' into master
This commit is contained in:
commit
82e0db5dfa
|
|
@ -107,6 +107,23 @@ func (r *Inputer) updateMembership(
|
||||||
return updates, nil
|
return updates, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In an ideal world, we shouldn't ever have "add" be nil and "remove" be
|
||||||
|
// set, as this implies that we're deleting a state event without replacing
|
||||||
|
// it (a thing that ordinarily shouldn't happen in Matrix). However, state
|
||||||
|
// resets are sadly a thing occasionally and we have to account for that.
|
||||||
|
// Beforehand there used to be a check here which stopped dead if we hit
|
||||||
|
// this scenario, but that meant that the membership table got out of sync
|
||||||
|
// after a state reset, often thinking that the user was still joined to
|
||||||
|
// the room even though the room state said otherwise, and this would prevent
|
||||||
|
// the user from being able to attempt to rejoin the room without modifying
|
||||||
|
// the database. So instead what we'll do is we'll just update the membership
|
||||||
|
// table to say that the user is "leave" and we'll use the old event to
|
||||||
|
// avoid nil pointer exceptions on the code path that follows.
|
||||||
|
if add == nil {
|
||||||
|
add = remove
|
||||||
|
newMembership = gomatrixserverlib.Leave
|
||||||
|
}
|
||||||
|
|
||||||
mu, err := updater.MembershipUpdater(targetUserNID, r.isLocalTarget(add))
|
mu, err := updater.MembershipUpdater(targetUserNID, r.isLocalTarget(add))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const (
|
||||||
|
|
||||||
// Defaults sets the request defaults
|
// Defaults sets the request defaults
|
||||||
func Defaults(r *gomatrixserverlib.MSC2946SpacesRequest) {
|
func Defaults(r *gomatrixserverlib.MSC2946SpacesRequest) {
|
||||||
r.Limit = 100
|
r.Limit = 2000
|
||||||
r.MaxRoomsPerSpace = -1
|
r.MaxRoomsPerSpace = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,9 +108,6 @@ func federatedSpacesHandler(
|
||||||
JSON: jsonerror.BadJSON("The request body could not be decoded into valid JSON. " + err.Error()),
|
JSON: jsonerror.BadJSON("The request body could not be decoded into valid JSON. " + err.Error()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if r.Limit > 100 {
|
|
||||||
r.Limit = 100
|
|
||||||
}
|
|
||||||
w := walker{
|
w := walker{
|
||||||
req: &r,
|
req: &r,
|
||||||
rootRoomID: roomID,
|
rootRoomID: roomID,
|
||||||
|
|
@ -147,9 +144,6 @@ func spacesHandler(
|
||||||
if resErr := chttputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
if resErr := chttputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
||||||
return *resErr
|
return *resErr
|
||||||
}
|
}
|
||||||
if r.Limit > 100 {
|
|
||||||
r.Limit = 100
|
|
||||||
}
|
|
||||||
w := walker{
|
w := walker{
|
||||||
req: &r,
|
req: &r,
|
||||||
rootRoomID: roomID,
|
rootRoomID: roomID,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue