summary refs log tree commit diff
path: root/synapse/storage/account_data.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-04-28 14:17:13 +0100
committerGitHub <noreply@github.com>2017-04-28 14:17:13 +0100
commit303326189161849af1a281a5597d997089b47543 (patch)
treee6d3ed861395b958d269fc4e5fd2fd654dd5a3aa /synapse/storage/account_data.py
parentMerge pull request #2163 from matrix-org/erikj/fix_invite_state (diff)
parentRemove unused import (diff)
downloadsynapse-303326189161849af1a281a5597d997089b47543.tar.xz
Merge pull request #2080 from matrix-org/erikj/filter_speed
Speed up filtering of a single event in push
Diffstat (limited to 'synapse/storage/account_data.py')
-rw-r--r--synapse/storage/account_data.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/storage/account_data.py b/synapse/storage/account_data.py
index aa84ffc2b0..ff14e54c11 100644
--- a/synapse/storage/account_data.py
+++ b/synapse/storage/account_data.py
@@ -308,3 +308,16 @@ class AccountDataStore(SQLBaseStore):
             " WHERE stream_id < ?"
         )
         txn.execute(update_max_id_sql, (next_id, next_id))
+
+    @cachedInlineCallbacks(num_args=2, cache_context=True, max_entries=5000)
+    def is_ignored_by(self, ignored_user_id, ignorer_user_id, cache_context):
+        ignored_account_data = yield self.get_global_account_data_by_type_for_user(
+            "m.ignored_user_list", ignorer_user_id,
+            on_invalidate=cache_context.invalidate,
+        )
+        if not ignored_account_data:
+            defer.returnValue(False)
+
+        defer.returnValue(
+            ignored_user_id in ignored_account_data.get("ignored_users", {})
+        )