mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-08-16 18:01:35 +00:00
reviewed changes
This commit is contained in:
parent
1761de5d03
commit
a51a4fdef9
6 changed files with 39 additions and 95 deletions
|
@ -1,5 +1,3 @@
|
|||
use std::ops::Deref;
|
||||
|
||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{
|
||||
api::client_server::{self, membership::join_room_by_id_helper},
|
||||
|
@ -17,7 +15,7 @@ use ruma::{
|
|||
uiaa::{AuthFlow, AuthType, UiaaInfo},
|
||||
},
|
||||
events::{room::message::RoomMessageEventContent, GlobalAccountDataEventType},
|
||||
push, RoomId, UserId,
|
||||
push, UserId,
|
||||
};
|
||||
use tracing::{info, warn};
|
||||
|
||||
|
@ -66,7 +64,7 @@ pub async fn get_register_available_route(
|
|||
Ok(get_username_availability::v3::Response { available: true })
|
||||
}
|
||||
|
||||
/// # `POST /_matrix/client/r0/register`
|
||||
/// # `POST /_matrix/client/r0/register
|
||||
///
|
||||
/// Register an account on this homeserver.
|
||||
///
|
||||
|
@ -293,30 +291,25 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
|
|||
}
|
||||
}
|
||||
|
||||
let _user_id = user_id.clone();
|
||||
let default_rooms = services().globals.default_rooms().await?;
|
||||
let servers: Vec<_> = default_rooms
|
||||
.iter()
|
||||
.map(Deref::deref)
|
||||
.filter_map(RoomId::server_name)
|
||||
.map(Into::into)
|
||||
.filter_map(|r| r.server_name().map(ToOwned::to_owned))
|
||||
.collect();
|
||||
|
||||
tokio::spawn(async move {
|
||||
for room_id in default_rooms {
|
||||
if let Err(e) = join_room_by_id_helper(
|
||||
Some(&_user_id),
|
||||
room_id,
|
||||
Some("All men are equal before fish.".to_owned()),
|
||||
&servers,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
{
|
||||
warn!("Failed to join default room: {}", e);
|
||||
}
|
||||
for room_id in &default_rooms {
|
||||
if let Err(e) = join_room_by_id_helper(
|
||||
Some(&user_id),
|
||||
room_id,
|
||||
Some("All men are equal before fish.".to_owned()),
|
||||
&servers,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
{
|
||||
warn!("Failed to join default room: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(register::v3::Response {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue