Skip to content

Commit

Permalink
feat(sdk): Remove the SlidingSyncRoom::required_state method.
Browse files Browse the repository at this point in the history
This patch removes a useless and not used (in the Matrix Rust SDK, along with the FFI bindings) method: `SlidingSyncRoom::required_state`.
  • Loading branch information
Hywan committed Feb 1, 2024
1 parent 0805f65 commit 5c0cab3
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions crates/matrix-sdk/src/sliding_sync/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use std::{

use eyeball_im::Vector;
use matrix_sdk_base::{deserialized_responses::SyncTimelineEvent, latest_event::LatestEvent};
use ruma::{
api::client::sync::sync_events::v4, events::AnySyncStateEvent, serde::Raw, OwnedRoomId, RoomId,
};
use ruma::{api::client::sync::sync_events::v4, OwnedRoomId, RoomId};
use serde::{Deserialize, Serialize};

use crate::Client;
Expand Down Expand Up @@ -84,11 +82,6 @@ impl SlidingSyncRoom {
inner.initial
}

/// Get the required state.
pub fn required_state(&self) -> Vec<Raw<AnySyncStateEvent>> {
self.inner.inner.read().unwrap().required_state.clone()
}

/// Get the token for back-pagination.
pub fn prev_batch(&self) -> Option<String> {
self.inner.inner.read().unwrap().prev_batch.clone()
Expand Down Expand Up @@ -483,65 +476,6 @@ mod tests {
}
}

#[async_test]
async fn test_required_state() {
// Default value.
{
let room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;

assert!(room.required_state().is_empty());
}

// Some value when initializing.
{
let room = new_room(
room_id!("!foo:bar.org"),
room_response!({
"required_state": [
{
"sender": "@alice:example.com",
"type": "m.room.join_rules",
"state_key": "",
"content": {
"join_rule": "invite"
}
}
]
}),
)
.await;

assert!(!room.required_state().is_empty());
}

// Some value when updating.
{
let mut room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;

assert!(room.required_state().is_empty());

room.update(
room_response!({
"required_state": [
{
"sender": "@alice:example.com",
"type": "m.room.join_rules",
"state_key": "",
"content": {
"join_rule": "invite"
}
}
]
}),
vec![],
);
assert!(!room.required_state().is_empty());

room.update(room_response!({}), vec![]);
assert!(!room.required_state().is_empty());
}
}

#[async_test]
async fn test_timeline_queue_initially_empty() {
let room = new_room(room_id!("!foo:bar.org"), room_response!({})).await;
Expand Down

0 comments on commit 5c0cab3

Please sign in to comment.