Add unstable-synapse-quirks feature for Sessions struct and fields
This commit is contained in:
parent
254b24fb20
commit
101b8689a5
@ -34,4 +34,14 @@ tasks:
|
||||
cargo test --all-features --verbose
|
||||
id_test_2_exit=$?
|
||||
|
||||
# ruma-client_api also has a few features. Make sure it works both with
|
||||
# all of them and none of them being enabled.
|
||||
cd ruma-client-api
|
||||
|
||||
cargo test --no-default-features --verbose
|
||||
id_test_1_exit=$?
|
||||
|
||||
cargo test --all-features --verbose
|
||||
id_test_2_exit=$?
|
||||
|
||||
exit $(( $fmt_exit || $clippy_exit || $test_exit || $id_test_1_exit || $id_test_2_exit ))
|
||||
|
@ -34,6 +34,16 @@ tasks:
|
||||
cargo test --all-features --verbose
|
||||
id_test_2_exit=$?
|
||||
|
||||
# ruma-client_api also has a few features. Make sure it works both with
|
||||
# all of them and none of them being enabled.
|
||||
cd ruma-client-api
|
||||
|
||||
cargo test --no-default-features --verbose
|
||||
id_test_1_exit=$?
|
||||
|
||||
cargo test --all-features --verbose
|
||||
id_test_2_exit=$?
|
||||
|
||||
exit $(( $fmt_exit || $clippy_exit || $test_exit || $id_test_1_exit || $id_test_2_exit ))
|
||||
# TODO: Add audit task once cargo-audit binary releases are available.
|
||||
# See https://github.com/RustSec/cargo-audit/issues/66
|
||||
|
@ -34,3 +34,4 @@ matches = "0.1.8"
|
||||
|
||||
[features]
|
||||
unstable-pre-spec = []
|
||||
unstable-synapse-quirks = []
|
||||
|
@ -3,7 +3,6 @@
|
||||
pub mod account;
|
||||
pub mod alias;
|
||||
pub mod appservice;
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
pub mod backup;
|
||||
pub mod capabilities;
|
||||
pub mod config;
|
||||
|
@ -14,6 +14,15 @@ use std::collections::BTreeMap;
|
||||
|
||||
use crate::r0::keys::AlgorithmAndDeviceId;
|
||||
|
||||
// TODO: remove
|
||||
/// A wrapper around a mapping of session IDs to key data.
|
||||
#[cfg(feature = "unstable-synapse-quirks")]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Sessions {
|
||||
/// A map of session IDs to key data.
|
||||
pub sessions: BTreeMap<String, KeyData>,
|
||||
}
|
||||
|
||||
/// The algorithm used for storing backups.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "algorithm", content = "auth_data")]
|
||||
|
@ -5,9 +5,6 @@ use std::collections::BTreeMap;
|
||||
use js_int::UInt;
|
||||
use ruma_api::ruma_api;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::KeyData;
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -27,7 +24,12 @@ ruma_api! {
|
||||
/// A map from room IDs to session IDs to key data.
|
||||
///
|
||||
/// Note: synapse has the `sessions: {}` wrapper, the Matrix spec does not.
|
||||
pub rooms: BTreeMap<RoomId, Sessions>,
|
||||
#[cfg(feature = "unstable-synapse-quirks")]
|
||||
pub rooms: BTreeMap<RoomId, super::Sessions>,
|
||||
|
||||
/// A map from room IDs to session IDs to key data.
|
||||
#[cfg(not(feature = "unstable-synapse-quirks"))]
|
||||
pub rooms: BTreeMap<RoomId, BTreeMap<String, super::KeyData>>,
|
||||
}
|
||||
|
||||
response: {
|
||||
@ -41,12 +43,3 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/// A wrapper around a mapping of session IDs to key data.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Sessions {
|
||||
// TODO: remove
|
||||
/// A map of session IDs to key data.
|
||||
pub sessions: BTreeMap<String, KeyData>,
|
||||
}
|
||||
|
@ -4,9 +4,6 @@ use std::collections::BTreeMap;
|
||||
|
||||
use ruma_api::ruma_api;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::KeyData;
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -28,17 +25,13 @@ ruma_api! {
|
||||
/// A map from room IDs to session IDs to key data.
|
||||
///
|
||||
/// Note: synapse has the `sessions: {}` wrapper, the Matrix spec does not.
|
||||
pub rooms: BTreeMap<RoomId, Sessions>,
|
||||
#[cfg(feature = "unstable-synapse-quirks")]
|
||||
pub rooms: BTreeMap<RoomId, super::Sessions>,
|
||||
|
||||
/// A map from room IDs to session IDs to key data.
|
||||
#[cfg(not(feature = "unstable-synapse-quirks"))]
|
||||
pub rooms: BTreeMap<RoomId, BTreeMap<String, super::KeyData>>,
|
||||
}
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/// A wrapper around a mapping of session IDs to key data.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Sessions {
|
||||
// TODO: remove
|
||||
/// A map of session IDs to key data.
|
||||
pub sessions: BTreeMap<String, KeyData>,
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ edition = "2018"
|
||||
either = ["ruma-identifiers/either"]
|
||||
rand = ["ruma-identifiers/rand"]
|
||||
unstable-pre-spec = ["ruma-client-api/unstable-pre-spec"]
|
||||
unstable-synapse-quirks = ["ruma-client-api/unstable-synapse-quirks"]
|
||||
|
||||
appservice-api = ["ruma-api", "ruma-appservice-api", "ruma-events"]
|
||||
client-api = ["ruma-api", "ruma-client-api", "ruma-events"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user