Compare commits

...

11 commits

Author SHA1 Message Date
7e07d246df
split out room info into its own function 2024-08-22 15:14:19 -07:00
fbd8780600
Make commands plural 2024-08-22 15:13:48 -07:00
73ef497609
ran cargo fmt 2024-08-22 15:13:38 -07:00
6e105a8a41
Fix table headers and pagination 2024-08-22 15:12:58 -07:00
5443768b5c
List pagination and html tables 2024-08-22 15:12:58 -07:00
0328932c54
Room directory admin commands 2024-08-22 15:12:57 -07:00
048dfef76c
reply to messages 2024-08-22 15:12:55 -07:00
36dbf8ce89
Admin room alias commands
- room alias set
- room alias remove
- room alias which
- room alias list
2024-08-22 15:01:56 -07:00
7a0ae6c09a
Add appservice show command to show config 2024-08-22 14:52:03 -07:00
fc8d8df801
Allow using languages in code blocks.
```yaml
This works now
```
2024-08-22 14:52:02 -07:00
e972ef6891
Rework admin commands to use subcommands.
This commit doesn't add, remove, or change any
commands, it only organizes them
2024-08-22 14:51:57 -07:00
5 changed files with 1027 additions and 656 deletions

View file

@ -75,4 +75,28 @@ impl service::rooms::alias::Data for KeyValueDatabase {
}) })
.transpose() .transpose()
} }
fn all_local_aliases<'a>(
&'a self,
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a> {
Box::new(
self.alias_roomid
.iter()
.map(|(room_alias_bytes, room_id_bytes)| {
let room_alias_localpart = utils::string_from_bytes(&room_alias_bytes)
.map_err(|_| {
Error::bad_database("Invalid alias bytes in aliasid_alias.")
})?;
let room_id = utils::string_from_bytes(&room_id_bytes)
.map_err(|_| {
Error::bad_database("Invalid room_id bytes in aliasid_alias.")
})?
.try_into()
.map_err(|_| Error::bad_database("Invalid room_id in aliasid_alias."))?;
Ok((room_id, room_alias_localpart))
}),
)
}
} }

File diff suppressed because it is too large Load diff

View file

@ -19,4 +19,9 @@ pub trait Data: Send + Sync {
&'a self, &'a self,
room_id: &RoomId, room_id: &RoomId,
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a>; ) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a>;
/// Returns all local aliases on the server
fn all_local_aliases<'a>(
&'a self,
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a>;
} }

View file

@ -98,4 +98,11 @@ impl Service {
) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a> { ) -> Box<dyn Iterator<Item = Result<OwnedRoomAliasId>> + 'a> {
self.db.local_aliases_for_room(room_id) self.db.local_aliases_for_room(room_id)
} }
#[tracing::instrument(skip(self))]
pub fn all_local_aliases<'a>(
&'a self,
) -> Box<dyn Iterator<Item = Result<(OwnedRoomId, String)>> + 'a> {
self.db.all_local_aliases()
}
} }

View file

@ -506,7 +506,11 @@ impl Service {
.state_cache .state_cache
.is_joined(server_user, &admin_room)? .is_joined(server_user, &admin_room)?
{ {
services().admin.process_message(body); services().admin.process_message(
body,
pdu.event_id.clone(),
pdu.sender.clone(),
);
} }
} }
} }