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:
parent
b5e318561c
commit
f6d14fdabd
3 changed files with 19 additions and 18 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -2521,7 +2521,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.12.5"
|
version = "0.12.5"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
@ -2540,7 +2540,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.12.2"
|
version = "0.12.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2552,7 +2552,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.20.4"
|
version = "0.20.4"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"assign",
|
"assign",
|
||||||
|
@ -2575,7 +2575,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.15.4"
|
version = "0.15.4"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
@ -2607,7 +2607,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.30.4"
|
version = "0.30.4"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap 2.9.0",
|
"indexmap 2.9.0",
|
||||||
|
@ -2631,7 +2631,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.11.2"
|
version = "0.11.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"headers",
|
"headers",
|
||||||
|
@ -2653,7 +2653,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
|
@ -2662,7 +2662,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.15.2"
|
version = "0.15.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
|
@ -2677,7 +2677,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2689,7 +2689,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.17.1"
|
version = "0.17.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
@ -2705,7 +2705,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git#71069c43650d2a797181aaa2ecc63037eaece907"
|
source = "git+https://github.com/ruma/ruma.git#739fecf1af28c7348442fc27a66ab34222b99ec3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub async fn create_room_route(
|
||||||
|
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
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)?;
|
services().rooms.short.get_or_create_shortroomid(&room_id)?;
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ pub async fn upgrade_room_route(
|
||||||
.authorization;
|
.authorization;
|
||||||
|
|
||||||
// Create a replacement room
|
// Create a replacement room
|
||||||
let replacement_room = RoomId::new(services().globals.server_name());
|
let replacement_room = RoomId::new_v1(services().globals.server_name());
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.short
|
.short
|
||||||
|
@ -689,10 +689,11 @@ pub async fn upgrade_room_route(
|
||||||
.map_err(|_| Error::bad_database("Invalid room event in database."))?;
|
.map_err(|_| Error::bad_database("Invalid room event in database."))?;
|
||||||
|
|
||||||
// Use the m.room.tombstone event as the predecessor
|
// Use the m.room.tombstone event as the predecessor
|
||||||
let predecessor = Some(ruma::events::room::create::PreviousRoom::new(
|
#[allow(deprecated)]
|
||||||
body.room_id.clone(),
|
let predecessor = Some(ruma::events::room::create::PreviousRoom {
|
||||||
(*tombstone_event_id).to_owned(),
|
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
|
// Send a m.room.create event containing a predecessor field and the applicable room_version
|
||||||
if rules.use_room_create_sender {
|
if rules.use_room_create_sender {
|
||||||
|
|
|
@ -1672,7 +1672,7 @@ impl Service {
|
||||||
/// Users in this room are considered admins by conduit, and the room can be
|
/// 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.
|
/// used to issue admin commands by talking to the server user inside it.
|
||||||
pub(crate) async fn create_admin_room(&self) -> Result<()> {
|
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)?;
|
services().rooms.short.get_or_create_shortroomid(&room_id)?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue