summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:47:02 +0100
committerOlivier Wilkinson (reivilibre) <olivier@librepush.net>2019-08-08 11:47:02 +0100
commitb3844451f92050910276e34a6bd89fe24331bf1d (patch)
treed880970b0f0c1ba1447355d671d5006eed7afbac
parentFix tests (diff)
downloadsynapse-b3844451f92050910276e34a6bd89fe24331bf1d.tar.xz
Introduce `get_room_state`; a way to get state for a single room
Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
-rw-r--r--synapse/storage/stats.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py
index 755faaaaa2..63f0fc5314 100644
--- a/synapse/storage/stats.py
+++ b/synapse/storage/stats.py
@@ -748,6 +748,20 @@ class StatsStore(StateDeltasStore):
             "room_state", None, retcols=("name", "topic", "canonical_alias")
         )
 
+    def get_room_state(self, room_id):
+        return self._simple_select_one(
+            "room_state",
+            {"room_id": room_id},
+            retcols=(
+                "name",
+                "topic",
+                "canonical_alias",
+                "avatar",
+                "join_rules",
+                "history_visibility",
+            ),
+        )
+
     @cached()
     def get_earliest_token_for_stats(self, stats_type, id):
         """