Skip to content

Commit

Permalink
Merge branch 'main' into issue-299-new
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinaboos authored Dec 30, 2024
2 parents 52435f1 + 5645e28 commit eaa666d
Show file tree
Hide file tree
Showing 6 changed files with 311 additions and 197 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions src/home/room_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,13 @@ impl Widget for RoomScreen {
// that its timeline events have been updated in the background.
if let Event::Signal = event {
self.process_timeline_updates(cx, &portal_list);

// Ideally we would do this elsewhere on the main thread, because it's not room-specific,
// but it doesn't hurt to do it here.
// TODO: move this up a layer to something higher in the UI tree,
// and wrap it in a `if let Event::Signal` conditional.
user_profile_cache::process_user_profile_updates(cx);
avatar_cache::process_avatar_updates(cx);
}

if let Event::Actions(actions) = event {
Expand Down Expand Up @@ -3628,10 +3635,12 @@ fn set_avatar_and_get_username(
// Get the display name and avatar URL from the sender's profile, if available,
// or if the profile isn't ready, fall back to qeurying our user profile cache.
let (username_opt, avatar_state) = match sender_profile {
TimelineDetails::Ready(profile) => (
profile.display_name.clone(),
AvatarState::Known(profile.avatar_url.clone()),
),
TimelineDetails::Ready(profile) => {
(
profile.display_name.clone(),
AvatarState::Known(profile.avatar_url.clone()),
)
}
not_ready => {
if matches!(not_ready, TimelineDetails::Unavailable) {
if let Some(event_id) = event_id {
Expand All @@ -3642,7 +3651,7 @@ fn set_avatar_and_get_username(
}
}
// log!("populate_message_view(): sender profile not ready yet for event {not_ready:?}");
user_profile_cache::with_user_profile(cx, sender_user_id, |profile, room_members| {
user_profile_cache::with_user_profile(cx, sender_user_id.to_owned(), true, |profile, room_members| {
room_members
.get(room_id)
.map(|rm| {
Expand All @@ -3651,7 +3660,12 @@ fn set_avatar_and_get_username(
AvatarState::Known(rm.avatar_url().map(|u| u.to_owned())),
)
})
.unwrap_or_else(|| (profile.username.clone(), profile.avatar_state.clone()))
.unwrap_or_else(|| {
(
profile.username.clone(),
profile.avatar_state.clone(),
)
})
})
.unwrap_or((None, AvatarState::Unknown))
}
Expand Down
Loading

0 comments on commit eaa666d

Please sign in to comment.