summary refs log tree commit diff
path: root/synapse/storage/room.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-05-04 19:08:27 +0100
committerErik Johnston <erik@matrix.org>2016-05-04 19:08:27 +0100
commitfee1118a207f1f07f21c3b8bf52d40c4f891bbcb (patch)
treec563ec6102a9899981b51bfc51945a3d9baef664 /synapse/storage/room.py
parentImplement basic ignore user (diff)
parentMerge pull request #762 from matrix-org/erikj/report_event (diff)
downloadsynapse-fee1118a207f1f07f21c3b8bf52d40c4f891bbcb.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/ignore_user
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r--synapse/storage/room.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 70aa64fb31..26933e593a 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -23,6 +23,7 @@ from .engines import PostgresEngine, Sqlite3Engine
 
 import collections
 import logging
+import ujson as json
 
 logger = logging.getLogger(__name__)
 
@@ -221,3 +222,20 @@ class RoomStore(SQLBaseStore):
                     aliases.extend(e.content['aliases'])
 
         defer.returnValue((name, aliases))
+
+    def add_event_report(self, room_id, event_id, user_id, reason, content,
+                         received_ts):
+        next_id = self._event_reports_id_gen.get_next()
+        return self._simple_insert(
+            table="event_reports",
+            values={
+                "id": next_id,
+                "received_ts": received_ts,
+                "room_id": room_id,
+                "event_id": event_id,
+                "user_id": user_id,
+                "reason": reason,
+                "content": json.dumps(content),
+            },
+            desc="add_event_report"
+        )