fix: workaround for missing avatars on element and rooms becoming historical

This commit is contained in:
Timo Kösters 2022-10-11 17:10:09 +02:00
parent fb6bfa9753
commit 31d1801912
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
2 changed files with 15 additions and 0 deletions

View file

@ -170,6 +170,9 @@ pub async fn get_message_events_route(
.collect(); .collect();
for (_, event) in &events_after { for (_, event) in &events_after {
/* TODO: Remove this when these are resolved:
* https://github.com/vector-im/element-android/issues/3417
* https://github.com/vector-im/element-web/issues/21034
if !services().rooms.lazy_loading.lazy_load_was_sent_before( if !services().rooms.lazy_loading.lazy_load_was_sent_before(
sender_user, sender_user,
sender_device, sender_device,
@ -178,6 +181,8 @@ pub async fn get_message_events_route(
)? { )? {
lazy_loaded.insert(event.sender.clone()); lazy_loaded.insert(event.sender.clone());
} }
*/
lazy_loaded.insert(event.sender.clone());
} }
next_token = events_after.last().map(|(count, _)| count).copied(); next_token = events_after.last().map(|(count, _)| count).copied();
@ -210,6 +215,9 @@ pub async fn get_message_events_route(
.collect(); .collect();
for (_, event) in &events_before { for (_, event) in &events_before {
/* TODO: Remove this when these are resolved:
* https://github.com/vector-im/element-android/issues/3417
* https://github.com/vector-im/element-web/issues/21034
if !services().rooms.lazy_loading.lazy_load_was_sent_before( if !services().rooms.lazy_loading.lazy_load_was_sent_before(
sender_user, sender_user,
sender_device, sender_device,
@ -218,6 +226,8 @@ pub async fn get_message_events_route(
)? { )? {
lazy_loaded.insert(event.sender.clone()); lazy_loaded.insert(event.sender.clone());
} }
*/
lazy_loaded.insert(event.sender.clone());
} }
next_token = events_before.last().map(|(count, _)| count).copied(); next_token = events_before.last().map(|(count, _)| count).copied();
@ -244,6 +254,8 @@ pub async fn get_message_events_route(
} }
} }
// TODO: enable again when we are sure clients can handle it
/*
if let Some(next_token) = next_token { if let Some(next_token) = next_token {
services().rooms.lazy_loading.lazy_load_mark_sent( services().rooms.lazy_loading.lazy_load_mark_sent(
sender_user, sender_user,
@ -253,6 +265,7 @@ pub async fn get_message_events_route(
next_token, next_token,
); );
} }
*/
Ok(resp) Ok(resp)
} }

View file

@ -433,6 +433,8 @@ async fn sync_helper(
} else if !lazy_load_enabled } else if !lazy_load_enabled
|| body.full_state || body.full_state
|| timeline_users.contains(&state_key) || timeline_users.contains(&state_key)
// TODO: Delete the following line when this is resolved: https://github.com/vector-im/element-web/issues/22565
|| *sender_user == state_key
{ {
let pdu = match services().rooms.timeline.get_pdu(&id)? { let pdu = match services().rooms.timeline.get_pdu(&id)? {
Some(pdu) => pdu, Some(pdu) => pdu,