Bug fix and minor improvements

Bug fixes:
- Do not send typing notice and set room read
  markers when the account is invisible
- Fix typing on set_presence
- Allow users to unset status message by setting
  it to blank
- Escape html tags of status message on
  SubtitleLabel of MemberDelegate

Improvements:
- Display user ID and status message on a tooltip
  by hovering account or room member name
This commit is contained in:
vslg
2020-07-07 11:42:16 -03:00
committed by miruka
parent a1f38fe8d8
commit edc8e04ce7
4 changed files with 48 additions and 8 deletions

View File

@@ -317,7 +317,8 @@ class Backend:
"""
async def update(client: MatrixClient) -> None:
room = self.models[client.user_id, "rooms"].get(room_id)
room = self.models[client.user_id, "rooms"].get(room_id)
account = self.models["accounts"][client.user_id]
if room:
room.set_fields(
@@ -327,7 +328,10 @@ class Backend:
local_highlights = False,
)
await client.update_account_unread_counts()
await client.update_receipt_marker(room_id, event_id)
# Only update server markers if the account is not invisible
if account.presence != Presence.State.invisible:
await client.update_receipt_marker(room_id, event_id)
await asyncio.gather(*[update(c) for c in self.clients.values()])

View File

@@ -1064,6 +1064,17 @@ class MatrixClient(nio.AsyncClient):
])
async def room_typing(
self, room_id: str, typing_state: bool = True, timeout: int = 5000,
):
"""Set typing notice to the server."""
# Do not send typing notice if the user is invisible
if self.models["accounts"][self.user_id].presence != \
Presence.State.invisible:
await super().room_typing(room_id, typing_state, timeout)
async def get_redacted_event_content(
self,
nio_type: Type[nio.Event],
@@ -1222,11 +1233,11 @@ class MatrixClient(nio.AsyncClient):
async def set_presence(
self, presence: str, status_msg: str = None,
self, presence: str, status_msg: Optional[str] = None,
) -> None:
"""Set presence state for this account."""
status_msg = status_msg or (
status_msg = status_msg if status_msg is not None else (
self.models["accounts"][self.user_id].status_msg
)