diff options
author | kegsay <kegan@matrix.org> | 2021-07-13 12:22:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 12:22:27 +0100 |
commit | 7df3e691f218c7af7337ca2729d1cbaf3586726f (patch) | |
tree | 39556e430bdeaae24c5cc8b1f0d2d1208eb82991 /federationapi | |
parent | f8ae391a5b7b506bb2f64547b9415fc9bf068913 (diff) |
Fix failing complement test (#1917)
Specifically `TestBannedUserCannotSendJoin`
Diffstat (limited to 'federationapi')
-rw-r--r-- | federationapi/routing/join.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index e9414033..a8f850fb 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -271,17 +271,27 @@ func SendJoin( // Check if the user is already in the room. If they're already in then // there isn't much point in sending another join event into the room. + // Also check to see if they are banned: if they are then we reject them. alreadyJoined := false + isBanned := false for _, se := range stateAndAuthChainResponse.StateEvents { if !se.StateKeyEquals(*event.StateKey()) { continue } if membership, merr := se.Membership(); merr == nil { alreadyJoined = (membership == gomatrixserverlib.Join) + isBanned = (membership == gomatrixserverlib.Ban) break } } + if isBanned { + return util.JSONResponse{ + Code: http.StatusForbidden, + JSON: jsonerror.Forbidden("user is banned"), + } + } + // Send the events to the room server. // We are responsible for notifying other servers that the user has joined // the room, so set SendAsServer to cfg.Matrix.ServerName |