mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-04 05:58:11 -04:00
refactor(base): room::sync_v2::update_(joined|left)_room use room::Room.
This patch uses the `room::Room` structure in `room::sync_v2` to reduce the number of arguments of the `update_joined_room` and the `update_left_room` processors.
This commit is contained in:
@@ -542,11 +542,13 @@ impl BaseClient {
|
||||
for (room_id, joined_room) in response.rooms.join {
|
||||
let joined_room_update = processors::room::sync_v2::update_joined_room(
|
||||
&mut context,
|
||||
&room_id,
|
||||
processors::room::Room::new(
|
||||
&room_id,
|
||||
self.room_info_notable_update_sender.clone(),
|
||||
requested_required_states,
|
||||
&mut ambiguity_cache,
|
||||
),
|
||||
joined_room,
|
||||
requested_required_states,
|
||||
self.room_info_notable_update_sender.clone(),
|
||||
&mut ambiguity_cache,
|
||||
&mut updated_members_in_room,
|
||||
processors::notification::Notification::new(
|
||||
&push_rules,
|
||||
@@ -568,11 +570,13 @@ impl BaseClient {
|
||||
for (room_id, left_room) in response.rooms.leave {
|
||||
let left_room_update = processors::room::sync_v2::update_left_room(
|
||||
&mut context,
|
||||
&room_id,
|
||||
processors::room::Room::new(
|
||||
&room_id,
|
||||
self.room_info_notable_update_sender.clone(),
|
||||
requested_required_states,
|
||||
&mut ambiguity_cache,
|
||||
),
|
||||
left_room,
|
||||
requested_required_states,
|
||||
self.room_info_notable_update_sender.clone(),
|
||||
&mut ambiguity_cache,
|
||||
processors::notification::Notification::new(
|
||||
&push_rules,
|
||||
&mut notifications,
|
||||
|
||||
@@ -22,7 +22,10 @@ use tokio::sync::broadcast::Sender;
|
||||
|
||||
#[cfg(feature = "e2e-encryption")]
|
||||
use super::super::e2ee;
|
||||
use super::super::{account_data, ephemeral_events, notification, state_events, timeline, Context};
|
||||
use super::{
|
||||
super::{account_data, ephemeral_events, notification, state_events, timeline, Context},
|
||||
Room as RoomCreationData,
|
||||
};
|
||||
use crate::{
|
||||
store::ambiguity_map::AmbiguityCache,
|
||||
sync::{InvitedRoomUpdate, JoinedRoomUpdate, KnockedRoomUpdate, LeftRoomUpdate},
|
||||
@@ -33,15 +36,19 @@ use crate::{
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn update_joined_room(
|
||||
context: &mut Context,
|
||||
room_id: &RoomId,
|
||||
room_creation_data: RoomCreationData<'_>,
|
||||
joined_room: JoinedRoom,
|
||||
requested_required_states: &RequestedRequiredStates,
|
||||
room_info_notable_update_sender: Sender<RoomInfoNotableUpdate>,
|
||||
ambiguity_cache: &mut AmbiguityCache,
|
||||
updated_members_in_room: &mut BTreeMap<OwnedRoomId, BTreeSet<OwnedUserId>>,
|
||||
notification: notification::Notification<'_>,
|
||||
#[cfg(feature = "e2e-encryption")] e2ee: e2ee::E2EE<'_>,
|
||||
) -> Result<JoinedRoomUpdate> {
|
||||
let RoomCreationData {
|
||||
room_id,
|
||||
room_info_notable_update_sender,
|
||||
requested_required_states,
|
||||
ambiguity_cache,
|
||||
} = room_creation_data;
|
||||
|
||||
let state_store = notification.state_store;
|
||||
|
||||
let room =
|
||||
@@ -147,14 +154,18 @@ pub async fn update_joined_room(
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn update_left_room(
|
||||
context: &mut Context,
|
||||
room_id: &RoomId,
|
||||
room_creation_data: RoomCreationData<'_>,
|
||||
left_room: LeftRoom,
|
||||
requested_required_states: &RequestedRequiredStates,
|
||||
room_info_notable_update_sender: Sender<RoomInfoNotableUpdate>,
|
||||
ambiguity_cache: &mut AmbiguityCache,
|
||||
notification: notification::Notification<'_>,
|
||||
#[cfg(feature = "e2e-encryption")] e2ee: e2ee::E2EE<'_>,
|
||||
) -> Result<LeftRoomUpdate> {
|
||||
let RoomCreationData {
|
||||
room_id,
|
||||
room_info_notable_update_sender,
|
||||
requested_required_states,
|
||||
ambiguity_cache,
|
||||
} = room_creation_data;
|
||||
|
||||
let state_store = notification.state_store;
|
||||
|
||||
let room =
|
||||
|
||||
Reference in New Issue
Block a user