identifiers: Deprecate constructing Matrix URI for event with room alias
According to MSC4132 / Matrix 1.11
This commit is contained in:
parent
bc39c04af9
commit
a17c0516d6
@ -23,6 +23,8 @@ Improvements:
|
|||||||
- Add `MatrixVersion::V1_11`
|
- Add `MatrixVersion::V1_11`
|
||||||
- Clarify in the docs of `AuthScheme` that sending an access token via a query
|
- Clarify in the docs of `AuthScheme` that sending an access token via a query
|
||||||
parameter is deprecated, according to MSC4126 / Matrix 1.11.
|
parameter is deprecated, according to MSC4126 / Matrix 1.11.
|
||||||
|
- Constructing a Matrix URI for an event with a room alias is deprecated,
|
||||||
|
according to MSC4132 / Matrix 1.11
|
||||||
|
|
||||||
# 0.13.0
|
# 0.13.0
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ pub enum MatrixId {
|
|||||||
User(OwnedUserId),
|
User(OwnedUserId),
|
||||||
|
|
||||||
/// An event ID.
|
/// An event ID.
|
||||||
|
///
|
||||||
|
/// Constructing this variant from an `OwnedRoomAliasId` is deprecated, because room aliases
|
||||||
|
/// are mutable, so the URI might break after a while.
|
||||||
Event(OwnedRoomOrAliasId, OwnedEventId),
|
Event(OwnedRoomOrAliasId, OwnedEventId),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,12 +575,11 @@ mod tests {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
"https://matrix.to/#/!ruma:notareal.hs?via=notareal.hs"
|
"https://matrix.to/#/!ruma:notareal.hs?via=notareal.hs"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
#[allow(deprecated)]
|
||||||
room_alias_id!("#ruma:notareal.hs")
|
let uri = room_alias_id!("#ruma:notareal.hs")
|
||||||
.matrix_to_event_uri(event_id!("$event:notareal.hs"))
|
.matrix_to_event_uri(event_id!("$event:notareal.hs"))
|
||||||
.to_string(),
|
.to_string();
|
||||||
"https://matrix.to/#/%23ruma:notareal.hs/$event:notareal.hs"
|
assert_eq!(uri, "https://matrix.to/#/%23ruma:notareal.hs/$event:notareal.hs");
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
room_id!("!ruma:notareal.hs")
|
room_id!("!ruma:notareal.hs")
|
||||||
.matrix_to_event_uri(event_id!("$event:notareal.hs"))
|
.matrix_to_event_uri(event_id!("$event:notareal.hs"))
|
||||||
@ -869,12 +871,11 @@ mod tests {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
"matrix:roomid/ruma:notareal.hs?via=notareal.hs&via=anotherunreal.hs&action=join"
|
"matrix:roomid/ruma:notareal.hs?via=notareal.hs&via=anotherunreal.hs&action=join"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
#[allow(deprecated)]
|
||||||
room_alias_id!("#ruma:notareal.hs")
|
let uri = room_alias_id!("#ruma:notareal.hs")
|
||||||
.matrix_event_uri(event_id!("$event:notareal.hs"))
|
.matrix_event_uri(event_id!("$event:notareal.hs"))
|
||||||
.to_string(),
|
.to_string();
|
||||||
"matrix:r/ruma:notareal.hs/e/event:notareal.hs"
|
assert_eq!(uri, "matrix:r/ruma:notareal.hs/e/event:notareal.hs");
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
room_id!("!ruma:notareal.hs")
|
room_id!("!ruma:notareal.hs")
|
||||||
.matrix_event_uri(event_id!("$event:notareal.hs"))
|
.matrix_event_uri(event_id!("$event:notareal.hs"))
|
||||||
|
@ -37,6 +37,9 @@ impl RoomAliasId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a `matrix.to` URI for an event scoped under this room alias ID.
|
/// Create a `matrix.to` URI for an event scoped under this room alias ID.
|
||||||
|
///
|
||||||
|
/// This is deprecated because room aliases are mutable, so the URI might break after a while.
|
||||||
|
#[deprecated = "Use `RoomId::matrix_to_event_uri` instead."]
|
||||||
pub fn matrix_to_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixToUri {
|
pub fn matrix_to_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixToUri {
|
||||||
MatrixToUri::new((self.to_owned(), ev_id.into()).into(), Vec::new())
|
MatrixToUri::new((self.to_owned(), ev_id.into()).into(), Vec::new())
|
||||||
}
|
}
|
||||||
@ -49,6 +52,9 @@ impl RoomAliasId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a `matrix:` URI for an event scoped under this room alias ID.
|
/// Create a `matrix:` URI for an event scoped under this room alias ID.
|
||||||
|
///
|
||||||
|
/// This is deprecated because room aliases are mutable, so the URI might break after a while.
|
||||||
|
#[deprecated = "Use `RoomId::matrix_event_uri` instead."]
|
||||||
pub fn matrix_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixUri {
|
pub fn matrix_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixUri {
|
||||||
MatrixUri::new((self.to_owned(), ev_id.into()).into(), Vec::new(), None)
|
MatrixUri::new((self.to_owned(), ev_id.into()).into(), Vec::new(), None)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user