1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-11 17:50:59 +00:00

feat: MSC4291, Room IDs as hashes of the create event (1/2)

This commit is contained in:
Matthias Ahouansou 2025-08-01 15:52:52 +02:00
parent b5e318561c
commit f6d14fdabd
No known key found for this signature in database
3 changed files with 19 additions and 18 deletions

22
Cargo.lock generated
View file

@ -2521,7 +2521,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.12.5"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"assign",
"js_int",
@ -2540,7 +2540,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.12.2"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"js_int",
"ruma-common",
@ -2552,7 +2552,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.20.4"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"as_variant",
"assign",
@ -2575,7 +2575,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.15.4"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"as_variant",
"base64 0.22.1",
@ -2607,7 +2607,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.30.4"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"as_variant",
"indexmap 2.9.0",
@ -2631,7 +2631,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.11.2"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"bytes",
"headers",
@ -2653,7 +2653,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.10.1"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"js_int",
"thiserror 2.0.12",
@ -2662,7 +2662,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.15.2"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"cfg-if",
"proc-macro-crate",
@ -2677,7 +2677,7 @@ dependencies = [
[[package]]
name = "ruma-push-gateway-api"
version = "0.11.0"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"js_int",
"ruma-common",
@ -2689,7 +2689,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.17.1"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
@ -2705,7 +2705,7 @@ dependencies = [
[[package]]
name = "ruma-state-res"
version = "0.13.0"
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
dependencies = [
"js_int",
"ruma-common",

View file

@ -57,7 +57,7 @@ pub async fn create_room_route(
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let room_id = RoomId::new(services().globals.server_name());
let room_id = RoomId::new_v1(services().globals.server_name());
services().rooms.short.get_or_create_shortroomid(&room_id)?;
@ -622,7 +622,7 @@ pub async fn upgrade_room_route(
.authorization;
// Create a replacement room
let replacement_room = RoomId::new(services().globals.server_name());
let replacement_room = RoomId::new_v1(services().globals.server_name());
services()
.rooms
.short
@ -689,10 +689,11 @@ pub async fn upgrade_room_route(
.map_err(|_| Error::bad_database("Invalid room event in database."))?;
// Use the m.room.tombstone event as the predecessor
let predecessor = Some(ruma::events::room::create::PreviousRoom::new(
body.room_id.clone(),
(*tombstone_event_id).to_owned(),
));
#[allow(deprecated)]
let predecessor = Some(ruma::events::room::create::PreviousRoom {
room_id: body.room_id.clone(),
event_id: Some((*tombstone_event_id).to_owned()),
});
// Send a m.room.create event containing a predecessor field and the applicable room_version
if rules.use_room_create_sender {

View file

@ -1672,7 +1672,7 @@ impl Service {
/// Users in this room are considered admins by conduit, and the room can be
/// used to issue admin commands by talking to the server user inside it.
pub(crate) async fn create_admin_room(&self) -> Result<()> {
let room_id = RoomId::new(services().globals.server_name());
let room_id = RoomId::new_v1(services().globals.server_name());
services().rooms.short.get_or_create_shortroomid(&room_id)?;