fix force room banning for room alias resolution

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-15 22:22:32 -04:00 committed by June
parent 8e77d60abf
commit 160b9afe97

View file

@ -4,7 +4,7 @@ use clap::Subcommand;
use ruma::{ use ruma::{
events::room::message::RoomMessageEventContent, OwnedRoomId, OwnedUserId, RoomAliasId, RoomId, RoomOrAliasId, events::room::message::RoomMessageEventContent, OwnedRoomId, OwnedUserId, RoomAliasId, RoomId, RoomOrAliasId,
}; };
use tracing::{debug, error, info}; use tracing::{debug, error, info, warn};
use crate::{ use crate::{
api::client_server::{get_alias_helper, leave_room}, api::client_server::{get_alias_helper, leave_room},
@ -261,7 +261,7 @@ pub(crate) async fn process(command: RoomModerationCommand, body: Vec<&str>) ->
Err(e) => { Err(e) => {
if force { if force {
// ignore rooms we failed to parse if we're force banning // ignore rooms we failed to parse if we're force banning
error!( warn!(
"Error parsing room \"{room}\" during bulk room banning, ignoring \ "Error parsing room \"{room}\" during bulk room banning, ignoring \
error and logging here: {e}" error and logging here: {e}"
); );
@ -301,10 +301,10 @@ pub(crate) async fn process(command: RoomModerationCommand, body: Vec<&str>) ->
response.room_id response.room_id
}, },
Err(e) => { Err(e) => {
// don't fail if force blocking
if force { if force {
format!( warn!("Failed to resolve room alias {room} to a room ID: {e}");
"Failed to resolve room alias {room} to a room ID: {e}" continue;
);
} }
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(