Don't add profile events to the timeline (for now)

This commit is contained in:
miruka 2019-08-30 10:09:09 -04:00
parent 19cbfc9cfe
commit a987cf48e6
2 changed files with 19 additions and 8 deletions

View File

@ -11,7 +11,14 @@
- When qml syntax highlighting supports ES6 string interpolation, use them - When qml syntax highlighting supports ES6 string interpolation, use them
- Fixes - Fixes
- Daybreak?
- Collapsing last account with shortcut when focused on room
- Using up/down when sidepane focused
- Missing hourglass when changing avatar and applying
- Icons on KDE
- Send typing state when no alias
- Greentext for local echo - Greentext for local echo
- Show error if uploading avatar fails - Show error if uploading avatar fails
- Don't strip user spacing in html - Don't strip user spacing in html
@ -24,6 +31,7 @@
- UI - UI
- Reduce icons brightness - Reduce icons brightness
- Thinner expand arrow
- Restore previous focus after closing right click context menu - Restore previous focus after closing right click context menu
- Choose a better default easing type for animations - Choose a better default easing type for animations
- Make HListView scrollbars visible - Make HListView scrollbars visible

View File

@ -386,17 +386,20 @@ class MatrixClient(nio.AsyncClient):
room.last_event = item.serialized room.last_event = item.serialized
return return
for_us = item.target_id in self.backend.clients
is_profile_ev = item.type_specifier == TypeSpecifier.profile_change is_profile_ev = item.type_specifier == TypeSpecifier.profile_change
# If there were no better events available to show previously # If there were no better events available to show previously
prev_is_member_ev = \ prev_is_profile_ev = \
isinstance(room.last_event["source"], nio.RoomMemberEvent) room.last_event["type_specifier"] == TypeSpecifier.profile_change
if is_profile_ev and for_us and not prev_is_member_ev: # If this is a profile event, only replace the currently shown one if
# it was also a profile event (we had nothing better to show).
if is_profile_ev and not prev_is_profile_ev:
return return
if item.date < room.last_event["date"]: # If this is a past event # If this event is older than the currently shown one, only replace
# it if the previous was a profile event.
if item.date < room.last_event["date"] and not prev_is_profile_ev:
return return
room.last_event = item.serialized room.last_event = item.serialized
@ -693,7 +696,7 @@ class MatrixClient(nio.AsyncClient):
account.display_name = now["displayname"] or "" account.display_name = now["displayname"] or ""
account.avatar_url = now["avatar_url"] or "" account.avatar_url = now["avatar_url"] or ""
if ev.state_key in self.backend.clients or len(room.users) > 50: # Hide profile events from the timeline - XXX
self.skipped_events[room.room_id] += 1 self.skipped_events[room.room_id] += 1
return None return None