From fe92ce6730216da8a69188e93a06a323ec8e5707 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 28 Feb 2021 12:07:00 -0400 Subject: [PATCH] Fix avatar/display name missing from notifications This happened when we got a message from an account-room pair where the full member list hadn't been loaded yet, i.e. the user had never focused the room since starting the client --- docs/TODO.md | 4 +--- src/backend/matrix_client.py | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index 77ecf646..00854c4f 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -17,9 +17,7 @@ - Change docs linking to dev branch back to master - Implement fallback QML notifications, usable if dbus isn't available -- profiles missing in notifications -- option to use plaintext notifications -- Notification urgency level (plyer)? +- Option to use plaintext notifications - add http_proxy support - image viewer: can't expand image in reduced window layout diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index e357fdbb..b661d579 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -2429,6 +2429,14 @@ class MatrixClient(nio.AsyncClient): if not rule.notify and not rule.highlight: return item + if must_fetch_sender: + sender_name, sender_avatar, _ = await self.get_member_profile( + room.room_id, ev.sender, can_fetch_from_network=True, + ) + item.set_fields( + sender_name=sender_name, sender_avatar=sender_avatar, + ) + sender = item.sender_name or item.sender_id if isinstance(ev, nio.RoomMessageEmote):