Skip to content

Commit

Permalink
Change ban errors to use 'kick' style
Browse files Browse the repository at this point in the history
This signals to the client that it should close itself.
  • Loading branch information
Askaholic committed Dec 27, 2023
1 parent 89c9e60 commit da15cda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion server/lobbyconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ async def on_message_received(self, message):
except BanError as e:
await self.send({
"command": "notice",
"style": "error",
# Tell the client to close itself. This prevents it from getting
# stuck in an auto-reconnect loop.
"style": "kick",
"text": e.message()
})
await self.abort(e.message())
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def test_server_ban(lobby_server, user):
msg = await proto.read_message()
assert msg == {
"command": "notice",
"style": "error",
"style": "kick",
"text": (
"You are banned from FAF forever. <br>Reason: <br>Test permanent ban"
"<br><br><i>If you would like to appeal this ban, please send an "
Expand Down Expand Up @@ -73,7 +73,7 @@ async def test_server_ban_token(lobby_server, user, jwk_priv_key, jwk_kid):
msg = await proto.read_message()
assert msg == {
"command": "notice",
"style": "error",
"style": "kick",
"text": (
"You are banned from FAF forever. <br>Reason: <br>Test permanent ban"
"<br><br><i>If you would like to appeal this ban, please send an "
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ async def test_server_ban_prevents_hosting(lobby_server, database, command):
msg = await proto.read_message()
assert msg == {
"command": "notice",
"style": "error",
"style": "kick",
"text": (
"You are banned from FAF forever. <br>Reason: <br>Test live ban<br>"
"<br><i>If you would like to appeal this ban, please send an email "
Expand Down

0 comments on commit da15cda

Please sign in to comment.