summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-05-18 17:10:35 +0100
committerNeil Johnson <neil@matrix.org>2018-05-18 17:10:35 +0100
commit644aac5f73dbacfe4cb47af09e804b9d1d2788a4 (patch)
tree36c9b7ba8581af0b99bc50610466d6f6460d2d37 /synapse
parentMerge pull request #3241 from matrix-org/fix_user_visits_insertion (diff)
downloadsynapse-644aac5f73dbacfe4cb47af09e804b9d1d2788a4.tar.xz
Tighter filtering for user_daily_visits
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index ac264b5d25..979fa22438 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -379,7 +379,11 @@ class DataStore(RoomMemberStore, RoomStore,
                       WHERE timestamp = ?
                     ) udv
                     ON u.user_id = udv.user_id AND u.device_id=udv.device_id
-                    WHERE last_seen > ? AND last_seen <= ? AND udv.timestamp IS NULL
+                    INNER JOIN users ON users.name=u.user_id
+                    WHERE last_seen > ? AND last_seen <= ?
+                    AND udv.timestamp IS NULL AND users.is_guest=0
+                    AND users.appservice_id IS NULL
+                    GROUP BY u.user_id, u.device_id
             """
 
             # This means that the day has rolled over but there could still