Remove origin field from PDUs
It has been removed from the spec, for details see https://github.com/matrix-org/matrix-spec/pull/998
This commit is contained in:
parent
0450f9d8f7
commit
24bd27a3a9
@ -42,10 +42,6 @@ pub struct RoomV1Pdu {
|
|||||||
/// The user id of the user who sent this event.
|
/// The user id of the user who sent this event.
|
||||||
pub sender: Box<UserId>,
|
pub sender: Box<UserId>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-pre-spec"))]
|
|
||||||
/// The `server_name` of the homeserver that created this event.
|
|
||||||
pub origin: String,
|
|
||||||
|
|
||||||
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
|
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
|
||||||
/// of when this event was created.
|
/// of when this event was created.
|
||||||
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
|
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
|
||||||
@ -101,10 +97,6 @@ pub struct RoomV3Pdu {
|
|||||||
/// The user id of the user who sent this event.
|
/// The user id of the user who sent this event.
|
||||||
pub sender: Box<UserId>,
|
pub sender: Box<UserId>,
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-pre-spec"))]
|
|
||||||
/// The `server_name` of the homeserver that created this event.
|
|
||||||
pub origin: String,
|
|
||||||
|
|
||||||
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
|
/// Timestamp (milliseconds since the UNIX epoch) on originating homeserver
|
||||||
/// of when this event was created.
|
/// of when this event was created.
|
||||||
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
|
pub origin_server_ts: MilliSecondsSinceUnixEpoch,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![cfg(all(feature = "unstable-pdu", not(feature = "unstable-pre-spec")))]
|
#![cfg(all(feature = "unstable-pdu"))]
|
||||||
|
|
||||||
use std::{collections::BTreeMap, convert::TryInto};
|
use std::{collections::BTreeMap, convert::TryInto};
|
||||||
|
|
||||||
@ -32,7 +32,6 @@ fn serialize_pdu_as_v1() {
|
|||||||
room_id: room_id!("!n8f893n9:example.com").to_owned(),
|
room_id: room_id!("!n8f893n9:example.com").to_owned(),
|
||||||
event_id: event_id!("$somejoinevent:matrix.org").to_owned(),
|
event_id: event_id!("$somejoinevent:matrix.org").to_owned(),
|
||||||
sender: user_id!("@sender:example.com").to_owned(),
|
sender: user_id!("@sender:example.com").to_owned(),
|
||||||
origin: "matrix.org".into(),
|
|
||||||
origin_server_ts: MilliSecondsSinceUnixEpoch(1_592_050_773_658_u64.try_into().unwrap()),
|
origin_server_ts: MilliSecondsSinceUnixEpoch(1_592_050_773_658_u64.try_into().unwrap()),
|
||||||
kind: RoomEventType::RoomPowerLevels,
|
kind: RoomEventType::RoomPowerLevels,
|
||||||
content: to_raw_json_value(&json!({ "testing": 123 })).unwrap(),
|
content: to_raw_json_value(&json!({ "testing": 123 })).unwrap(),
|
||||||
@ -56,7 +55,6 @@ fn serialize_pdu_as_v1() {
|
|||||||
"room_id": "!n8f893n9:example.com",
|
"room_id": "!n8f893n9:example.com",
|
||||||
"event_id": "$somejoinevent:matrix.org",
|
"event_id": "$somejoinevent:matrix.org",
|
||||||
"sender": "@sender:example.com",
|
"sender": "@sender:example.com",
|
||||||
"origin": "matrix.org",
|
|
||||||
"origin_server_ts": 1_592_050_773_658_u64,
|
"origin_server_ts": 1_592_050_773_658_u64,
|
||||||
"type": "m.room.power_levels",
|
"type": "m.room.power_levels",
|
||||||
"content": {
|
"content": {
|
||||||
@ -98,7 +96,6 @@ fn serialize_pdu_as_v3() {
|
|||||||
let v3_pdu = RoomV3Pdu {
|
let v3_pdu = RoomV3Pdu {
|
||||||
room_id: room_id!("!n8f893n9:example.com").to_owned(),
|
room_id: room_id!("!n8f893n9:example.com").to_owned(),
|
||||||
sender: user_id!("@sender:example.com").to_owned(),
|
sender: user_id!("@sender:example.com").to_owned(),
|
||||||
origin: "matrix.org".into(),
|
|
||||||
origin_server_ts: MilliSecondsSinceUnixEpoch(1_592_050_773_658_u64.try_into().unwrap()),
|
origin_server_ts: MilliSecondsSinceUnixEpoch(1_592_050_773_658_u64.try_into().unwrap()),
|
||||||
kind: RoomEventType::RoomPowerLevels,
|
kind: RoomEventType::RoomPowerLevels,
|
||||||
content: to_raw_json_value(&json!({ "testing": 123 })).unwrap(),
|
content: to_raw_json_value(&json!({ "testing": 123 })).unwrap(),
|
||||||
@ -115,7 +112,6 @@ fn serialize_pdu_as_v3() {
|
|||||||
let json = json!({
|
let json = json!({
|
||||||
"room_id": "!n8f893n9:example.com",
|
"room_id": "!n8f893n9:example.com",
|
||||||
"sender": "@sender:example.com",
|
"sender": "@sender:example.com",
|
||||||
"origin": "matrix.org",
|
|
||||||
"origin_server_ts": 1_592_050_773_658_u64,
|
"origin_server_ts": 1_592_050_773_658_u64,
|
||||||
"type": "m.room.power_levels",
|
"type": "m.room.power_levels",
|
||||||
"content": {
|
"content": {
|
||||||
@ -158,7 +154,6 @@ fn deserialize_pdu_as_v1() {
|
|||||||
"hashes": {
|
"hashes": {
|
||||||
"sha256": "ThisHashCoversAllFieldsInCaseThisIsRedacted"
|
"sha256": "ThisHashCoversAllFieldsInCaseThisIsRedacted"
|
||||||
},
|
},
|
||||||
"origin": "matrix.org",
|
|
||||||
"origin_server_ts": 1_234_567_890,
|
"origin_server_ts": 1_234_567_890,
|
||||||
"prev_events": [
|
"prev_events": [
|
||||||
[
|
[
|
||||||
@ -198,7 +193,6 @@ fn deserialize_pdu_as_v1() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "unstable-pre-spec"))]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_pdu_as_v3() {
|
fn deserialize_pdu_as_v3() {
|
||||||
let json = json!({
|
let json = json!({
|
||||||
@ -213,7 +207,6 @@ fn deserialize_pdu_as_v3() {
|
|||||||
"hashes": {
|
"hashes": {
|
||||||
"sha256": "ThisHashCoversAllFieldsInCaseThisIsRedacted"
|
"sha256": "ThisHashCoversAllFieldsInCaseThisIsRedacted"
|
||||||
},
|
},
|
||||||
"origin": "matrix.org",
|
|
||||||
"origin_server_ts": 1_234_567_890,
|
"origin_server_ts": 1_234_567_890,
|
||||||
"prev_events": [
|
"prev_events": [
|
||||||
"$abc123:matrix.org"
|
"$abc123:matrix.org"
|
||||||
|
@ -17,9 +17,6 @@ all-features = true
|
|||||||
compat = []
|
compat = []
|
||||||
unstable-exhaustive-types = []
|
unstable-exhaustive-types = []
|
||||||
|
|
||||||
# Private, only used in test / benchmarking code
|
|
||||||
__ci = ["ruma-common/unstable-pre-spec"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
itertools = "0.10.0"
|
itertools = "0.10.0"
|
||||||
js_int = "0.2.0"
|
js_int = "0.2.0"
|
||||||
|
@ -395,8 +395,6 @@ where
|
|||||||
content,
|
content,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
unsigned: btreemap! {},
|
unsigned: btreemap! {},
|
||||||
#[cfg(not(feature = "__ci"))]
|
|
||||||
origin: "foo".into(),
|
|
||||||
auth_events,
|
auth_events,
|
||||||
prev_events,
|
prev_events,
|
||||||
depth: uint!(0),
|
depth: uint!(0),
|
||||||
|
@ -403,8 +403,6 @@ pub fn to_init_pdu_event(
|
|||||||
content,
|
content,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
unsigned: BTreeMap::new(),
|
unsigned: BTreeMap::new(),
|
||||||
#[cfg(not(feature = "__ci"))]
|
|
||||||
origin: "foo".into(),
|
|
||||||
auth_events: vec![],
|
auth_events: vec![],
|
||||||
prev_events: vec![],
|
prev_events: vec![],
|
||||||
depth: uint!(0),
|
depth: uint!(0),
|
||||||
@ -443,8 +441,6 @@ where
|
|||||||
content,
|
content,
|
||||||
redacts: None,
|
redacts: None,
|
||||||
unsigned: BTreeMap::new(),
|
unsigned: BTreeMap::new(),
|
||||||
#[cfg(not(feature = "__ci"))]
|
|
||||||
origin: "foo".into(),
|
|
||||||
auth_events,
|
auth_events,
|
||||||
prev_events,
|
prev_events,
|
||||||
depth: uint!(0),
|
depth: uint!(0),
|
||||||
|
@ -158,7 +158,6 @@ __ci = [
|
|||||||
"unstable-msc3554",
|
"unstable-msc3554",
|
||||||
"unstable-msc3618",
|
"unstable-msc3618",
|
||||||
"unstable-msc3723",
|
"unstable-msc3723",
|
||||||
"ruma-state-res/__ci",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user