Skip to content

Commit

Permalink
Add appeal email to ban message
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Jan 1, 2024
1 parent 5ec6398 commit bcb8f2a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion server/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def __init__(self, ban_expiry, ban_reason, *args, **kwargs):
def message(self):
return (
f"You are banned from FAF {self._ban_duration_text()}. <br>"
f"Reason: <br>{self.ban_reason}"
f"Reason: <br>{self.ban_reason}<br><br>"
"<i>If you would like to appeal this ban, please send an email to: "
"[email protected]</i>"
)

def _ban_duration_text(self):
Expand Down
6 changes: 5 additions & 1 deletion tests/integration_tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ async def test_server_ban(lobby_server, user):
assert msg == {
"command": "notice",
"style": "error",
"text": "You are banned from FAF forever. <br>Reason: <br>Test permanent ban"
"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 "
"email to: [email protected]</i>"
)
}


Expand Down
6 changes: 5 additions & 1 deletion tests/integration_tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,11 @@ async def test_server_ban_prevents_hosting(lobby_server, database, command):
assert msg == {
"command": "notice",
"style": "error",
"text": "You are banned from FAF forever. <br>Reason: <br>Test live ban"
"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 "
"to: [email protected]</i>"
)
}


Expand Down
5 changes: 4 additions & 1 deletion tests/unit_tests/test_lobbyconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,11 @@ async def test_abort_connection_if_banned(
lobbyconnection.player.id = 203
with pytest.raises(BanError) as banned_error:
await lobbyconnection.abort_connection_if_banned()
assert banned_error.value.message() == \
assert banned_error.value.message() == (
"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 email "
"to: [email protected]</i>"
)

# test user who is banned for another 46 hours
lobbyconnection.player.id = 204
Expand Down

0 comments on commit bcb8f2a

Please sign in to comment.