From 11bc72526842f6d4b6ae5f36ee4eb83df966d8d1 Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Sat, 20 Jan 2024 19:51:39 -0500
Subject: [PATCH] return joined member count of room for pushrules instead of
 hardcoded 10

im not sure what the TODO is trying to say here,
but since it's many years old and conduwuit is
fast, i dont see an issue with this.

Signed-off-by: strawberry <strawberry@puppygock.gay>
---
 src/service/pusher/mod.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs
index 015e36986..d3053ca76 100644
--- a/src/service/pusher/mod.rs
+++ b/src/service/pusher/mod.rs
@@ -200,7 +200,13 @@ pub fn get_actions<'a>(
 
         let ctx = PushConditionRoomCtx {
             room_id: room_id.to_owned(),
-            member_count: 10_u32.into(), // TODO: get member count efficiently
+            member_count: UInt::from(
+                services()
+                    .rooms
+                    .state_cache
+                    .room_joined_count(room_id)?
+                    .unwrap_or(1) as u32,
+            ),
             user_id: user.to_owned(),
             user_display_name: services()
                 .users
-- 
GitLab