Skip to content

Commit

Permalink
Post-ignore_user pagination does work to refill the cleared timeline.
Browse files Browse the repository at this point in the history
But, there are still a couple of things we need to fix up:
* saving which event ID is currently shown on each timeline,
  such that we can jump back to displaying that event after the
  timelines get cleared and then refilled.
* subscribing to an ignored user stream, such that we can receive
  an update when the current logged-in user (un)ignores someone
  from a different client that we do not control.
  * See `Client::subscribe_to_ignore_user_list_changes()`:
    <https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk/struct.Client.html#method.subscribe_to_ignore_user_list_changes>
  • Loading branch information
kevinaboos committed Aug 1, 2024
1 parent 343d52c commit 3544fbc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ impl Widget for Timeline {
if clear_cache {
tl.content_drawn_since_last_update.clear();
tl.profile_drawn_since_last_update.clear();
tl.fully_paginated = false;
} else {
tl.content_drawn_since_last_update.remove(changed_indices.clone());
tl.profile_drawn_since_last_update.remove(changed_indices.clone());
Expand Down
17 changes: 16 additions & 1 deletion src/sliding_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,26 @@ async fn async_worker(mut receiver: UnboundedReceiver<MatrixRequest>) -> Result<
if new_room_member.is_ignored() { "" } else { "un" },
);
enqueue_user_profile_update(UserProfileUpdate::RoomMemberOnly {
room_id,
room_id: room_id.clone(),
room_member: new_room_member,
});
}
}

// After a successful (un)ignore operation, all timelines get completely cleared,
// so we must re-fetch all timelines for all rooms.
// Start with the current room, since that's the one being displayed.
for room_id_to_paginate in client.get_room(&room_id)
.into_iter()
.chain(client.joined_rooms())
.map(|room| room.room_id().to_owned())
{
submit_async_request(MatrixRequest::PaginateRoomTimeline {
room_id: room_id_to_paginate,
num_events: 50,
forwards: false,
});
}
});
}

Expand Down

0 comments on commit 3544fbc

Please sign in to comment.