Bump ruma and fix failing unrecognized_event test
The test was broken because the JSON being fed into it was bad.master
parent
807432b31f
commit
47690bd268
|
@ -2201,7 +2201,7 @@ mod test {
|
|||
use super::*;
|
||||
|
||||
use crate::{EventEmitter, SyncRoom};
|
||||
use matrix_sdk_common::locks::RwLock;
|
||||
use matrix_sdk_common::{events::EventContent, locks::RwLock};
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
|
@ -2212,11 +2212,8 @@ mod test {
|
|||
impl EventEmitter for EE {
|
||||
async fn on_unrecognized_event(&self, room: SyncRoom, event: &CustomOrRawEvent<'_>) {
|
||||
if let SyncRoom::Joined(_) = room {
|
||||
if let CustomOrRawEvent::RawJson(raw) = event {
|
||||
let val = serde_json::to_value(raw).unwrap();
|
||||
if val.get("type").unwrap() == &json! { "m.room.message" }
|
||||
&& val.get("content").unwrap().get("m.relates_to").is_some()
|
||||
{
|
||||
if let CustomOrRawEvent::Message(event) = event {
|
||||
if event.content.event_type() == "m.room.not_real" {
|
||||
self.0.swap(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
@ -2232,7 +2229,18 @@ mod test {
|
|||
client.event_emitter = Arc::new(RwLock::new(Some(Box::new(emitter))));
|
||||
|
||||
// This is needed other wise the `EventBuilder` goes through a de/ser cycle and the `prev_content` is lost.
|
||||
let event: &serde_json::Value = &test_json::MESSAGE_EDIT;
|
||||
let event = json!({
|
||||
"content": {
|
||||
"whatever": "you want"
|
||||
},
|
||||
"event_id": "$eventid:foo",
|
||||
"origin_server_ts": 159026265,
|
||||
"sender": "@alice:matrix.org",
|
||||
"type": "m.room.not_real",
|
||||
"unsigned": {
|
||||
"age": 85
|
||||
}
|
||||
});
|
||||
|
||||
let mut joined_rooms: HashMap<RoomId, serde_json::Value> = HashMap::new();
|
||||
let joined_room = serde_json::json!({
|
||||
|
|
|
@ -269,12 +269,12 @@ lazy_static! {
|
|||
"msgtype": "m.text"
|
||||
},
|
||||
"m.relates_to": {
|
||||
"event_id": "some event id",
|
||||
"event_id": "$someeventid:foo",
|
||||
"rel_type": "m.replace"
|
||||
},
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "edit event id",
|
||||
"event_id": "$eventid:foo",
|
||||
"origin_server_ts": 159026265,
|
||||
"sender": "@alice:matrix.org",
|
||||
"type": "m.room.message",
|
||||
|
|
Loading…
Reference in New Issue