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
- 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
- Show error if uploading avatar fails
- Don't strip user spacing in html
@ -24,6 +31,7 @@
- UI
- Reduce icons brightness
- Thinner expand arrow
- Restore previous focus after closing right click context menu
- Choose a better default easing type for animations
- Make HListView scrollbars visible

View File

@ -386,17 +386,20 @@ class MatrixClient(nio.AsyncClient):
room.last_event = item.serialized
return
for_us = item.target_id in self.backend.clients
is_profile_ev = item.type_specifier == TypeSpecifier.profile_change
# If there were no better events available to show previously
prev_is_member_ev = \
isinstance(room.last_event["source"], nio.RoomMemberEvent)
prev_is_profile_ev = \
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
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
room.last_event = item.serialized
@ -693,7 +696,7 @@ class MatrixClient(nio.AsyncClient):
account.display_name = now["displayname"] 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
return None