mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-08-16 18:01:35 +00:00
make_join delegation
This commit is contained in:
parent
2089ca8e3c
commit
7e54066023
2 changed files with 18 additions and 15 deletions
|
@ -293,6 +293,7 @@ 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 default_rooms = services().globals.default_rooms().await?;
|
||||||
let servers: Vec<_> = default_rooms
|
let servers: Vec<_> = default_rooms
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -301,19 +302,21 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for room_id in default_rooms {
|
tokio::spawn(async move {
|
||||||
if let Err(e) = join_room_by_id_helper(
|
for room_id in default_rooms {
|
||||||
Some(&user_id),
|
if let Err(e) = join_room_by_id_helper(
|
||||||
room_id,
|
Some(&_user_id),
|
||||||
Some("All men are equal before fish.".to_owned()),
|
room_id,
|
||||||
&servers,
|
Some("All men are equal before fish.".to_owned()),
|
||||||
None,
|
&servers,
|
||||||
)
|
None,
|
||||||
.await
|
)
|
||||||
{
|
.await
|
||||||
warn!("Failed to join default room: {}", e);
|
{
|
||||||
|
warn!("Failed to join default room: {}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(register::v3::Response {
|
Ok(register::v3::Response {
|
||||||
|
|
|
@ -10,7 +10,7 @@ use tokio::sync::OnceCell;
|
||||||
use crate::api::server_server::DestinationResponse;
|
use crate::api::server_server::DestinationResponse;
|
||||||
|
|
||||||
use crate::{services, Config, Error, Result};
|
use crate::{services, Config, Error, Result};
|
||||||
use futures_util::{FutureExt, TryFutureExt};
|
use futures_util::FutureExt;
|
||||||
use hickory_resolver::TokioAsyncResolver;
|
use hickory_resolver::TokioAsyncResolver;
|
||||||
use hyper_util::client::legacy::connect::dns::{GaiResolver, Name as HyperName};
|
use hyper_util::client::legacy::connect::dns::{GaiResolver, Name as HyperName};
|
||||||
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
||||||
|
@ -519,7 +519,7 @@ impl Service {
|
||||||
for mut alias_or_id in self.config.default_rooms.iter().cloned() {
|
for mut alias_or_id in self.config.default_rooms.iter().cloned() {
|
||||||
// anything that does not start '!' should be considered an alias
|
// anything that does not start '!' should be considered an alias
|
||||||
// empty strings are ignored
|
// empty strings are ignored
|
||||||
let room_id = if Some('!') == alias_or_id.chars().next() {
|
let room_id = if alias_or_id.starts_with('!') {
|
||||||
if alias_or_id.split_once(':').is_none() {
|
if alias_or_id.split_once(':').is_none() {
|
||||||
alias_or_id = format!("{}:{}", alias_or_id, self.config.server_name);
|
alias_or_id = format!("{}:{}", alias_or_id, self.config.server_name);
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ impl Service {
|
||||||
Error::bad_config("Invalid room alias for join-by-default rooms.")
|
Error::bad_config("Invalid room alias for join-by-default rooms.")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if room_alias.server_name() == &self.config.server_name {
|
if room_alias.server_name() == self.config.server_name {
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.alias
|
.alias
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue