mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-26 20:43:48 +03:00
Merge branch 'remove-alias-command' into 'next'
feat(admin): remove alias command See merge request famedly/conduit!685
This commit is contained in:
commit
be1b8b68a7
1 changed files with 23 additions and 0 deletions
|
@ -77,6 +77,12 @@ enum AdminCommand {
|
|||
/// List all rooms we are currently handling an incoming pdu from
|
||||
IncomingFederation,
|
||||
|
||||
/// Removes an alias from the server
|
||||
RemoveAlias {
|
||||
/// The alias to be removed
|
||||
alias: Box<RoomAliasId>,
|
||||
},
|
||||
|
||||
/// Deactivate a user
|
||||
///
|
||||
/// User will not be removed from all rooms by default.
|
||||
|
@ -907,6 +913,23 @@ impl Service {
|
|||
)
|
||||
}
|
||||
}
|
||||
AdminCommand::RemoveAlias { alias } => {
|
||||
if alias.server_name() != services().globals.server_name() {
|
||||
RoomMessageEventContent::text_plain(
|
||||
"Cannot remove alias which is not from this server",
|
||||
)
|
||||
} else if services()
|
||||
.rooms
|
||||
.alias
|
||||
.resolve_local_alias(&alias)?
|
||||
.is_none()
|
||||
{
|
||||
RoomMessageEventContent::text_plain("No such alias exists")
|
||||
} else {
|
||||
services().rooms.alias.remove_alias(&alias)?;
|
||||
RoomMessageEventContent::text_plain("Alias removed sucessfully")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Ok(reply_message_content)
|
||||
|
|
Loading…
Reference in a new issue