remove box ids from admin room command arguments

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-08 04:39:01 +00:00 committed by Jade Ellis
commit b3e5d2f683
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
20 changed files with 128 additions and 129 deletions

View file

@ -3,9 +3,7 @@ use std::fmt::Write;
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::{
OwnedRoomAliasId, OwnedRoomId, RoomId, events::room::message::RoomMessageEventContent,
};
use ruma::{OwnedRoomAliasId, OwnedRoomId, events::room::message::RoomMessageEventContent};
use crate::{Command, escape_html};
@ -18,7 +16,7 @@ pub(crate) enum RoomAliasCommand {
force: bool,
/// The room id to set the alias on
room_id: Box<RoomId>,
room_id: OwnedRoomId,
/// The alias localpart to use (`alias`, not `#alias:servername.tld`)
room_alias_localpart: String,
@ -40,7 +38,7 @@ pub(crate) enum RoomAliasCommand {
/// - List aliases currently being used
List {
/// If set, only list the aliases for this room
room_id: Option<Box<RoomId>>,
room_id: Option<OwnedRoomId>,
},
}

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::Result;
use futures::StreamExt;
use ruma::{RoomId, events::room::message::RoomMessageEventContent};
use ruma::{OwnedRoomId, events::room::message::RoomMessageEventContent};
use crate::{Command, PAGE_SIZE, get_room_info};
@ -10,13 +10,13 @@ pub(crate) enum RoomDirectoryCommand {
/// - Publish a room to the room directory
Publish {
/// The room id of the room to publish
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
/// - Unpublish a room to the room directory
Unpublish {
/// The room id of the room to unpublish
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
/// - List rooms that are published

View file

@ -1,7 +1,7 @@
use clap::Subcommand;
use conduwuit::{Result, utils::ReadyExt};
use futures::StreamExt;
use ruma::{RoomId, events::room::message::RoomMessageEventContent};
use ruma::{OwnedRoomId, events::room::message::RoomMessageEventContent};
use crate::{admin_command, admin_command_dispatch};
@ -10,7 +10,7 @@ use crate::{admin_command, admin_command_dispatch};
pub(crate) enum RoomInfoCommand {
/// - List joined members in a room
ListJoinedMembers {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
/// Lists only our local users in the specified room
#[arg(long)]
@ -22,14 +22,14 @@ pub(crate) enum RoomInfoCommand {
/// Room topics can be huge, so this is in its
/// own separate command
ViewRoomTopic {
room_id: Box<RoomId>,
room_id: OwnedRoomId,
},
}
#[admin_command]
async fn list_joined_members(
&self,
room_id: Box<RoomId>,
room_id: OwnedRoomId,
local_only: bool,
) -> Result<RoomMessageEventContent> {
let room_name = self
@ -79,7 +79,7 @@ async fn list_joined_members(
}
#[admin_command]
async fn view_room_topic(&self, room_id: Box<RoomId>) -> Result<RoomMessageEventContent> {
async fn view_room_topic(&self, room_id: OwnedRoomId) -> Result<RoomMessageEventContent> {
let Ok(room_topic) = self
.services
.rooms

View file

@ -7,7 +7,7 @@ use conduwuit::{
};
use futures::StreamExt;
use ruma::{
OwnedRoomId, RoomAliasId, RoomId, RoomOrAliasId,
OwnedRoomId, OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId,
events::room::message::RoomMessageEventContent,
};
@ -24,7 +24,7 @@ pub(crate) enum RoomModerationCommand {
BanRoom {
/// The room in the format of `!roomid:example.com` or a room alias in
/// the format of `#roomalias:example.com`
room: Box<RoomOrAliasId>,
room: OwnedRoomOrAliasId,
},
/// - Bans a list of rooms (room IDs and room aliases) from a newline
@ -36,7 +36,7 @@ pub(crate) enum RoomModerationCommand {
UnbanRoom {
/// The room in the format of `!roomid:example.com` or a room alias in
/// the format of `#roomalias:example.com`
room: Box<RoomOrAliasId>,
room: OwnedRoomOrAliasId,
},
/// - List of all rooms we have banned
@ -49,7 +49,7 @@ pub(crate) enum RoomModerationCommand {
}
#[admin_command]
async fn ban_room(&self, room: Box<RoomOrAliasId>) -> Result<RoomMessageEventContent> {
async fn ban_room(&self, room: OwnedRoomOrAliasId) -> Result<RoomMessageEventContent> {
debug!("Got room alias or ID: {}", room);
let admin_room_alias = &self.services.globals.admin_alias;
@ -363,7 +363,7 @@ async fn ban_list_of_rooms(&self) -> Result<RoomMessageEventContent> {
}
#[admin_command]
async fn unban_room(&self, room: Box<RoomOrAliasId>) -> Result<RoomMessageEventContent> {
async fn unban_room(&self, room: OwnedRoomOrAliasId) -> Result<RoomMessageEventContent> {
let room_id = if room.is_room_id() {
let room_id = match RoomId::parse(&room) {
| Ok(room_id) => room_id,