Remove origin field from transactions and pdus for #[feature = "unstable-pre-spec"]
See https://github.com/matrix-org/synapse/issues/3816 Co-authored-by: Timo <timo@koesters.xyz>
This commit is contained in:
parent
192db0371c
commit
15e1a4bea8
@ -31,6 +31,7 @@ trybuild = "1.0.31"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
unstable-exhaustive-types = []
|
unstable-exhaustive-types = []
|
||||||
|
unstable-pre-spec = []
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "event_deserialize"
|
name = "event_deserialize"
|
||||||
|
@ -38,6 +38,7 @@ 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: UserId,
|
pub sender: UserId,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
/// The `server_name` of the homeserver that created this event.
|
/// The `server_name` of the homeserver that created this event.
|
||||||
pub origin: String,
|
pub origin: String,
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ 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: UserId,
|
pub sender: UserId,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
/// The `server_name` of the homeserver that created this event.
|
/// The `server_name` of the homeserver that created this event.
|
||||||
pub origin: String,
|
pub origin: String,
|
||||||
|
|
||||||
@ -172,6 +174,7 @@ pub struct RoomV1PduStub {
|
|||||||
/// The user id of the user who sent this event.
|
/// The user id of the user who sent this event.
|
||||||
pub sender: UserId,
|
pub sender: UserId,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
/// The `server_name` of the homeserver that created this event.
|
/// The `server_name` of the homeserver that created this event.
|
||||||
pub origin: String,
|
pub origin: String,
|
||||||
|
|
||||||
@ -226,6 +229,7 @@ impl RoomV1PduStub {
|
|||||||
event_id,
|
event_id,
|
||||||
room_id,
|
room_id,
|
||||||
sender: self.sender,
|
sender: self.sender,
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
origin: self.origin,
|
origin: self.origin,
|
||||||
origin_server_ts: self.origin_server_ts,
|
origin_server_ts: self.origin_server_ts,
|
||||||
kind: self.kind,
|
kind: self.kind,
|
||||||
@ -248,6 +252,7 @@ pub struct RoomV3PduStub {
|
|||||||
/// The user id of the user who sent this event.
|
/// The user id of the user who sent this event.
|
||||||
pub sender: UserId,
|
pub sender: UserId,
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
/// The `server_name` of the homeserver that created this event.
|
/// The `server_name` of the homeserver that created this event.
|
||||||
pub origin: String,
|
pub origin: String,
|
||||||
|
|
||||||
@ -301,6 +306,7 @@ impl RoomV3PduStub {
|
|||||||
RoomV3Pdu {
|
RoomV3Pdu {
|
||||||
room_id,
|
room_id,
|
||||||
sender: self.sender,
|
sender: self.sender,
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
origin: self.origin,
|
origin: self.origin,
|
||||||
origin_server_ts: self.origin_server_ts,
|
origin_server_ts: self.origin_server_ts,
|
||||||
kind: self.kind,
|
kind: self.kind,
|
||||||
|
@ -11,6 +11,7 @@ use ruma_events::{
|
|||||||
use ruma_identifiers::{event_id, room_id, server_key_id, server_name, user_id};
|
use ruma_identifiers::{event_id, room_id, server_key_id, server_name, user_id};
|
||||||
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};
|
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn serialize_stub_as_v1() {
|
fn serialize_stub_as_v1() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
@ -74,6 +75,7 @@ fn serialize_stub_as_v1() {
|
|||||||
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn serialize_stub_as_v3() {
|
fn serialize_stub_as_v3() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
@ -127,6 +129,7 @@ fn serialize_stub_as_v3() {
|
|||||||
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_stub_as_v1() {
|
fn deserialize_stub_as_v1() {
|
||||||
let json = json!({
|
let json = json!({
|
||||||
@ -184,6 +187,7 @@ fn deserialize_stub_as_v1() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn deserialize_stub_as_v3() {
|
fn deserialize_stub_as_v3() {
|
||||||
let json = json!({
|
let json = json!({
|
||||||
@ -227,6 +231,7 @@ fn deserialize_stub_as_v3() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn serialize_pdu_as_v1() {
|
fn serialize_pdu_as_v1() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
@ -294,6 +299,7 @@ fn serialize_pdu_as_v1() {
|
|||||||
assert_eq!(to_json_value(&pdu).unwrap(), json);
|
assert_eq!(to_json_value(&pdu).unwrap(), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn serialize_pdu_as_v3() {
|
fn serialize_pdu_as_v3() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
@ -349,6 +355,7 @@ fn serialize_pdu_as_v3() {
|
|||||||
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
assert_eq!(to_json_value(&pdu_stub).unwrap(), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_deserialize_pdu_as_v1() {
|
fn test_deserialize_pdu_as_v1() {
|
||||||
let json = json!({
|
let json = json!({
|
||||||
@ -408,6 +415,7 @@ fn test_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!({
|
||||||
@ -452,6 +460,7 @@ fn deserialize_pdu_as_v3() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn convert_v1_stub_to_pdu() {
|
fn convert_v1_stub_to_pdu() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
@ -528,6 +537,7 @@ fn convert_v1_stub_to_pdu() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn convert_v3_stub_to_pdu() {
|
fn convert_v3_stub_to_pdu() {
|
||||||
let mut signatures = BTreeMap::new();
|
let mut signatures = BTreeMap::new();
|
||||||
|
@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct RoomState {
|
pub struct RoomState {
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
/// The resident server's DNS name.
|
/// The resident server's DNS name.
|
||||||
pub origin: String,
|
pub origin: String,
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unstable-pre-spec"))]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use matches::assert_matches;
|
use matches::assert_matches;
|
||||||
|
@ -22,7 +22,7 @@ unstable-exhaustive-types = [
|
|||||||
"ruma-federation-api/unstable-exhaustive-types",
|
"ruma-federation-api/unstable-exhaustive-types",
|
||||||
"ruma-common/unstable-exhaustive-types",
|
"ruma-common/unstable-exhaustive-types",
|
||||||
]
|
]
|
||||||
unstable-pre-spec = ["ruma-client-api/unstable-pre-spec"]
|
unstable-pre-spec = ["ruma-client-api/unstable-pre-spec", "ruma-events/unstable-pre-spec"]
|
||||||
unstable-synapse-quirks = ["ruma-client-api/unstable-synapse-quirks"]
|
unstable-synapse-quirks = ["ruma-client-api/unstable-synapse-quirks"]
|
||||||
|
|
||||||
appservice-api = ["ruma-api", "ruma-appservice-api", "ruma-events"]
|
appservice-api = ["ruma-api", "ruma-appservice-api", "ruma-events"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user