Skip to content
Snippets Groups Projects
Commit f14a2536 authored by 🥺's avatar 🥺 :transgender_flag:
Browse files

add local_only arg to list joined members in room admin cmd

parent b3974c56
No related branches found
No related tags found
1 merge request!571Implement MSC4133 and MSC4175, some bug fixes and features, drop target CPU for aarch64 to Cortex-A53, bump to Rust 1.81.0, RocksDB v9.6.1, and Nix build fixes
......@@ -10,6 +10,10 @@ pub(crate) enum RoomInfoCommand {
/// - List joined members in a room
ListJoinedMembers {
room_id: Box<RoomId>,
/// Lists only our local users in the specified room
#[arg(long)]
local_only: bool,
},
/// - Displays room topic
......@@ -22,7 +26,7 @@ pub(crate) enum RoomInfoCommand {
}
#[admin_command]
async fn list_joined_members(&self, room_id: Box<RoomId>) -> Result<RoomMessageEventContent> {
async fn list_joined_members(&self, room_id: Box<RoomId>, local_only: bool) -> Result<RoomMessageEventContent> {
let room_name = self
.services
.rooms
......@@ -37,7 +41,15 @@ async fn list_joined_members(&self, room_id: Box<RoomId>) -> Result<RoomMessageE
.rooms
.state_cache
.room_members(&room_id)
.filter_map(Result::ok);
.filter_map(|member| {
if local_only {
member
.ok()
.filter(|user| self.services.globals.user_is_local(user))
} else {
member.ok()
}
});
let member_info = members
.into_iter()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment