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
This commit is contained in:
miruka 2021-02-28 12:07:00 -04:00
parent 26a68acefd
commit fe92ce6730
2 changed files with 9 additions and 3 deletions

View File

@ -17,9 +17,7 @@
- Change docs linking to dev branch back to master - Change docs linking to dev branch back to master
- Implement fallback QML notifications, usable if dbus isn't available - Implement fallback QML notifications, usable if dbus isn't available
- profiles missing in notifications - Option to use plaintext notifications
- option to use plaintext notifications
- Notification urgency level (plyer)?
- add http_proxy support - add http_proxy support
- image viewer: can't expand image in reduced window layout - image viewer: can't expand image in reduced window layout

View File

@ -2429,6 +2429,14 @@ class MatrixClient(nio.AsyncClient):
if not rule.notify and not rule.highlight: if not rule.notify and not rule.highlight:
return item 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 sender = item.sender_name or item.sender_id
if isinstance(ev, nio.RoomMessageEmote): if isinstance(ev, nio.RoomMessageEmote):