Skip to content

Commit

Permalink
Remove redadant checks for updating avator
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravlu committed Dec 27, 2024
1 parent 6df0710 commit 40a1b33
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/sliding_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,27 +1928,19 @@ fn update_avatar_for_latest_event(
let (timestamp, latest_message_text) = get_latest_event_details(event_tl_item, &room_id);

// Check for relevant state events.
match event_tl_item.content() {
TimelineItemContent::OtherState(other) => {
match other.content() {
AnyOtherFullStateEventContent::RoomName(FullStateEventContent::Original { content, .. }) => {
if let TimelineItemContent::OtherState(other) = event_tl_item.content() {
match other.content() {
AnyOtherFullStateEventContent::RoomName(FullStateEventContent::Original { content, .. }) => {
rooms_list::enqueue_rooms_list_update(RoomsListUpdate::UpdateRoomName {
room_id: room_id.clone(),
new_room_name: content.name.clone(),
});
}
AnyOtherFullStateEventContent::RoomAvatar(_avatar_event) => {
room_avatar_changed = true;
}
_ => { }
room_id: room_id.clone(),
new_room_name: content.name.clone(),
});
}
}
TimelineItemContent::MembershipChange(room_membership_change) => {
if let Some(MembershipChange::Invited) = room_membership_change.change() {

AnyOtherFullStateEventContent::RoomAvatar(_avatar_event) => {
room_avatar_changed = true;
}
_ => { }
}
_ => {}
}

enqueue_rooms_list_update(RoomsListUpdate::UpdateLatestEvent {
Expand Down

0 comments on commit 40a1b33

Please sign in to comment.