mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
chore: Clippy fixes
This commit is contained in:
+36
-35
@@ -73,23 +73,23 @@ struct DeviceListUpdates {
|
|||||||
|
|
||||||
impl DeviceListUpdates {
|
impl DeviceListUpdates {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
DeviceListUpdates {
|
Self {
|
||||||
changed: HashSet::new(),
|
changed: HashSet::new(),
|
||||||
left: HashSet::new(),
|
left: HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn merge(&mut self, other: DeviceListUpdates) {
|
fn merge(&mut self, other: Self) {
|
||||||
self.changed.extend(other.changed);
|
self.changed.extend(other.changed);
|
||||||
self.left.extend(other.left);
|
self.left.extend(other.left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<DeviceLists> for DeviceListUpdates {
|
impl From<DeviceListUpdates> for DeviceLists {
|
||||||
fn into(self) -> DeviceLists {
|
fn from(val: DeviceListUpdates) -> Self {
|
||||||
DeviceLists {
|
Self {
|
||||||
changed: self.changed.into_iter().collect(),
|
changed: val.changed.into_iter().collect(),
|
||||||
left: self.left.into_iter().collect(),
|
left: val.left.into_iter().collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ struct SyncContext<'a> {
|
|||||||
since: Option<u64>,
|
since: Option<u64>,
|
||||||
next_batch: u64,
|
next_batch: u64,
|
||||||
full_state: bool,
|
full_state: bool,
|
||||||
filter: &'a Box<FilterDefinition>,
|
filter: &'a FilterDefinition,
|
||||||
}
|
}
|
||||||
|
|
||||||
type PresenceUpdates = HashMap<OwnedUserId, PresenceEventContent>;
|
type PresenceUpdates = HashMap<OwnedUserId, PresenceEventContent>;
|
||||||
@@ -607,7 +607,6 @@ async fn load_joined_room(
|
|||||||
next_batch,
|
next_batch,
|
||||||
full_state,
|
full_state,
|
||||||
filter,
|
filter,
|
||||||
..
|
|
||||||
}: SyncContext<'_>,
|
}: SyncContext<'_>,
|
||||||
ref room_id: OwnedRoomId,
|
ref room_id: OwnedRoomId,
|
||||||
) -> Result<(JoinedRoom, DeviceListUpdates)> {
|
) -> Result<(JoinedRoom, DeviceListUpdates)> {
|
||||||
@@ -676,7 +675,7 @@ async fn load_joined_room(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return current_shortstatehash;
|
current_shortstatehash
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_notification_read: OptionFuture<_> = timeline_pdus
|
let last_notification_read: OptionFuture<_> = timeline_pdus
|
||||||
@@ -779,18 +778,16 @@ async fn load_joined_room(
|
|||||||
.lazy_loading
|
.lazy_loading
|
||||||
.reset(lazy_loading_context)
|
.reset(lazy_loading_context)
|
||||||
.await;
|
.await;
|
||||||
};
|
}
|
||||||
|
|
||||||
let state_initial = calculate_state_initial(
|
calculate_state_initial(
|
||||||
services,
|
services,
|
||||||
sender_user,
|
sender_user,
|
||||||
timeline_start_shortstatehash,
|
timeline_start_shortstatehash,
|
||||||
lazy_loading_witness.as_ref(),
|
lazy_loading_witness.as_ref(),
|
||||||
)
|
)
|
||||||
.boxed()
|
.boxed()
|
||||||
.await?;
|
.await?
|
||||||
|
|
||||||
state_initial
|
|
||||||
} else if limited {
|
} else if limited {
|
||||||
let state_incremental = calculate_state_incremental(
|
let state_incremental = calculate_state_incremental(
|
||||||
services,
|
services,
|
||||||
@@ -833,21 +830,27 @@ async fn load_joined_room(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
use MembershipState::*;
|
{
|
||||||
|
use MembershipState::*;
|
||||||
|
|
||||||
if matches!(content.membership, Leave | Join) {
|
if matches!(content.membership, Leave | Join) {
|
||||||
let shares_encrypted_room =
|
let shares_encrypted_room = share_encrypted_room(
|
||||||
share_encrypted_room(services, sender_user, &user_id, Some(room_id))
|
services,
|
||||||
.await;
|
sender_user,
|
||||||
match content.membership {
|
&user_id,
|
||||||
| Leave if !shares_encrypted_room => {
|
Some(room_id),
|
||||||
device_list_updates.left.insert(user_id);
|
)
|
||||||
},
|
.await;
|
||||||
| Join if joined_since_last_sync || shares_encrypted_room => {
|
match content.membership {
|
||||||
device_list_updates.changed.insert(user_id);
|
| Leave if !shares_encrypted_room => {
|
||||||
},
|
device_list_updates.left.insert(user_id);
|
||||||
| _ => (),
|
},
|
||||||
};
|
| Join if joined_since_last_sync || shares_encrypted_room => {
|
||||||
|
device_list_updates.changed.insert(user_id);
|
||||||
|
},
|
||||||
|
| _ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -884,12 +887,10 @@ async fn load_joined_room(
|
|||||||
})
|
})
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
let prev_batch = timeline_pdus.first().map(at!(0)).or_else(|| {
|
let prev_batch = timeline_pdus
|
||||||
joined_sender_member
|
.first()
|
||||||
.is_some()
|
.map(at!(0))
|
||||||
.and_then(|| since)
|
.or_else(|| joined_sender_member.is_some().and(since).map(Into::into));
|
||||||
.map(Into::into)
|
|
||||||
});
|
|
||||||
|
|
||||||
let timeline_pdus = timeline_pdus
|
let timeline_pdus = timeline_pdus
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ pub fn changes_since<'a>(
|
|||||||
|
|
||||||
// Skip the data that's exactly at since, because we sent that last time
|
// Skip the data that's exactly at since, because we sent that last time
|
||||||
// ...unless this is an initial sync, in which case send everything
|
// ...unless this is an initial sync, in which case send everything
|
||||||
let first_possible =
|
let first_possible = (room_id, user_id, since.map_or(0, |since| since.saturating_add(1)));
|
||||||
(room_id, user_id, since.map(|since| since.saturating_add(1)).unwrap_or(0));
|
|
||||||
|
|
||||||
self.db
|
self.db
|
||||||
.roomuserdataid_accountdata
|
.roomuserdataid_accountdata
|
||||||
|
|||||||
Reference in New Issue
Block a user