Skip to content

Commit 76b03f7

Browse files
gnietozecakeh
authored andcommitted
fix: Third party identifiers parsing
Current version requires that third party ids contains the fields `validated_at` and `added_at`, but Synapse admin API documentation does not list those fields in `create_or_modify` endpoint: https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#create-or-modify-account Since those fields are currently required, the endpoint may fail to deserialize legitimate requests.
1 parent 290e30d commit 76b03f7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Breaking changes:
1212
`RoomDetails` and `UserMinorDetails` are now non-exhaustive. To keep using
1313
them as if they were exhaustive, use the `ruma_unstable_exhaustive_types`
1414
compile-time `cfg` setting.
15+
* Changed `users::create_or_modify::v2` third party id parsing by adding a new type without `validated_at` and `added_at` fields (which are not sent according to the API documentation)
1516

1617
Improvement:
1718

src/users/create_or_modify/v2.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
33
use ruma::{
44
api::{metadata, request, response, Metadata},
5-
thirdparty::ThirdPartyIdentifier,
5+
thirdparty::Medium,
66
OwnedUserId,
77
};
8+
use serde::{Deserialize, Serialize};
89

910
pub use crate::users::{ExternalId, UserDetails};
1011

@@ -106,3 +107,14 @@ impl Response {
106107
Self { details }
107108
}
108109
}
110+
111+
/// An identifier external to Matrix.
112+
#[derive(Clone, Debug, Deserialize, Serialize)]
113+
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
114+
pub struct ThirdPartyIdentifier {
115+
/// The third party identifier address.
116+
pub address: String,
117+
118+
/// The medium of third party identifier.
119+
pub medium: Medium,
120+
}

0 commit comments

Comments
 (0)