Refactor MessageArea composer alias handling

Simplify the code, make it more declarative, and improve the reliability
of sending typing notifications (notably when changing the used alias in
the middle of a message).
This commit is contained in:
miruka
2020-08-24 05:44:25 -04:00
parent aba47ef26b
commit 83f35c034e
4 changed files with 68 additions and 84 deletions

View File

@@ -1239,8 +1239,8 @@ class MatrixClient(nio.AsyncClient):
):
"""Set typing notice to the server."""
# Do not send typing notice if the user is invisible
presence = self.models["accounts"][self.user_id].presence
if presence not in [Presence.State.invisible, Presence.State.offline]:
await super().room_typing(room_id, typing_state, timeout)