Refactor admin rooms moderation

Split alias.*_alias_by from alias.*_ailias
This commit is contained in:
dasha_uwu
2026-01-25 02:51:14 +05:00
parent 6014c0fd6c
commit 45f4496e4f
9 changed files with 132 additions and 400 deletions

View File

@@ -44,7 +44,7 @@ pub(crate) async fn create_alias_route(
services
.alias
.set_alias(&body.room_alias, &body.room_id, sender_user)?;
.set_alias_by(&body.room_alias, &body.room_id, sender_user)?;
Ok(create_alias::v3::Response::new())
}
@@ -66,7 +66,7 @@ pub(crate) async fn delete_alias_route(
services
.alias
.remove_alias(&body.room_alias, sender_user)
.remove_alias_by(&body.room_alias, sender_user)
.await?;
// TODO: update alt_aliases?

View File

@@ -406,7 +406,7 @@ pub(crate) async fn create_room_route(
if let Some(alias) = alias {
services
.alias
.set_alias(&alias, &room_id, sender_user)?;
.set_alias_by(&alias, &room_id, sender_user)?;
}
if body.visibility == room::Visibility::Public {

View File

@@ -448,7 +448,7 @@ async fn move_local_aliases(&self) -> Result {
.filter_map(|alias| {
self.services
.alias
.remove_alias(alias, self.sender_user)
.remove_alias_by(alias, self.sender_user)
.inspect_err(move |e| error!(?alias, ?self, "Failed to remove alias: {e}"))
.map_ok(move |()| alias)
.ok()
@@ -456,7 +456,7 @@ async fn move_local_aliases(&self) -> Result {
.ready_for_each(|alias| {
self.services
.alias
.set_alias(alias, self.new_room_id, self.sender_user)
.set_alias_by(alias, self.new_room_id, self.sender_user)
.inspect_err(|e| error!(?self, "Failed to add alias: {e}"))
.ok();
})