use hoist_and_deserialize for state events

master
Sorunome 2021-07-03 12:00:13 +02:00
parent f454d407af
commit 27ad1f42da
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
3 changed files with 9 additions and 6 deletions

View File

@ -14,6 +14,7 @@
// limitations under the License.
use std::ops::Deref;
use matrix_sdk_base::{hoist_and_deserialize_state_event, hoist_room_event_prev_content};
use matrix_sdk_common::async_trait;
use ruma::{
api::client::r0::push::get_notifications::Notification,
@ -91,7 +92,7 @@ impl Handler {
}
for (raw_event, event) in room_info.state.events.iter().filter_map(|e| {
if let Ok(d) = e.deserialize() {
if let Ok(d) = hoist_and_deserialize_state_event(e) {
Some((e, d))
} else {
None
@ -101,7 +102,7 @@ impl Handler {
}
for (raw_event, event) in room_info.timeline.events.iter().filter_map(|e| {
if let Ok(d) = e.event.deserialize() {
if let Ok(d) = hoist_room_event_prev_content(&e.event) {
Some((&e.event, d))
} else {
None
@ -121,7 +122,7 @@ impl Handler {
}
for (raw_event, event) in room_info.state.events.iter().filter_map(|e| {
if let Ok(d) = e.deserialize() {
if let Ok(d) = hoist_and_deserialize_state_event(e) {
Some((e, d))
} else {
None
@ -131,7 +132,7 @@ impl Handler {
}
for (raw_event, event) in room_info.timeline.events.iter().filter_map(|e| {
if let Ok(d) = e.event.deserialize() {
if let Ok(d) = hoist_room_event_prev_content(&e.event) {
Some((&e.event, d))
} else {
None

View File

@ -129,7 +129,7 @@ fn hoist_member_event(
Ok(e)
}
fn hoist_room_event_prev_content(
pub fn hoist_room_event_prev_content(
event: &Raw<AnySyncRoomEvent>,
) -> StdResult<AnySyncRoomEvent, serde_json::Error> {
let prev_content = event

View File

@ -50,7 +50,9 @@ mod rooms;
mod session;
mod store;
pub use client::{BaseClient, BaseClientConfig};
pub use client::{
hoist_and_deserialize_state_event, hoist_room_event_prev_content, BaseClient, BaseClientConfig,
};
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub use matrix_sdk_crypto as crypto;