@@ -1,6 +1,6 @@
|
|||||||
array-size-threshold = 4096
|
array-size-threshold = 4096
|
||||||
cognitive-complexity-threshold = 100 # TODO reduce me ALARA
|
cognitive-complexity-threshold = 100 # TODO reduce me ALARA
|
||||||
excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5
|
excessive-nesting-threshold = 8
|
||||||
future-size-threshold = 8192
|
future-size-threshold = 8192
|
||||||
stack-size-threshold = 196608 # TODO reduce me ALARA
|
stack-size-threshold = 196608 # TODO reduce me ALARA
|
||||||
too-many-lines-threshold = 780 # TODO reduce me to <= 100
|
too-many-lines-threshold = 780 # TODO reduce me to <= 100
|
||||||
|
|||||||
@@ -840,44 +840,51 @@ where
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
for (key, id) in current_state_ids {
|
for (key, id) in current_state_ids {
|
||||||
if since_state_ids.get(&key) != Some(&id) {
|
if since_state_ids.get(&key) == Some(&id) {
|
||||||
let Ok(pdu) = services.rooms.timeline.get_pdu(&id).await else {
|
continue;
|
||||||
error!("Pdu in state not found: {id}");
|
}
|
||||||
continue;
|
|
||||||
};
|
|
||||||
if pdu.kind == TimelineEventType::RoomMember {
|
|
||||||
if let Some(Ok(user_id)) = pdu.state_key.as_deref().map(UserId::parse)
|
|
||||||
{
|
|
||||||
if user_id == sender_user {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let content: RoomMemberEventContent = pdu.get_content()?;
|
let Ok(pdu) = services.rooms.timeline.get_pdu(&id).await else {
|
||||||
match content.membership {
|
error!("Pdu in state not found: {id}");
|
||||||
| MembershipState::Join => {
|
continue;
|
||||||
// A new user joined an encrypted room
|
};
|
||||||
if !share_encrypted_room(
|
|
||||||
services,
|
if pdu.kind != TimelineEventType::RoomMember {
|
||||||
sender_user,
|
continue;
|
||||||
user_id,
|
}
|
||||||
Some(room_id),
|
|
||||||
)
|
let Some(Ok(user_id)) = pdu.state_key.as_deref().map(UserId::parse) else {
|
||||||
.await
|
continue;
|
||||||
{
|
};
|
||||||
device_list_changes.insert(user_id.to_owned());
|
|
||||||
}
|
if user_id == sender_user {
|
||||||
},
|
continue;
|
||||||
| MembershipState::Leave => {
|
}
|
||||||
// Write down users that have left encrypted rooms we
|
|
||||||
// are in
|
let content: RoomMemberEventContent = pdu.get_content()?;
|
||||||
left_encrypted_users.insert(user_id.to_owned());
|
match content.membership {
|
||||||
},
|
| MembershipState::Join => {
|
||||||
| _ => {},
|
// A new user joined an encrypted room
|
||||||
}
|
if !share_encrypted_room(
|
||||||
|
services,
|
||||||
|
sender_user,
|
||||||
|
user_id,
|
||||||
|
Some(room_id),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
device_list_changes.insert(user_id.to_owned());
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
| MembershipState::Leave => {
|
||||||
|
// Write down users that have left encrypted rooms we
|
||||||
|
// are in
|
||||||
|
left_encrypted_users.insert(user_id.to_owned());
|
||||||
|
},
|
||||||
|
| _ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if joined_since_last_sync || new_encrypted_room {
|
if joined_since_last_sync || new_encrypted_room {
|
||||||
// If the user is in a new encrypted room, give them all joined users
|
// If the user is in a new encrypted room, give them all joined users
|
||||||
device_list_changes.extend(
|
device_list_changes.extend(
|
||||||
|
|||||||
Reference in New Issue
Block a user