mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-27 12:42:39 +00:00
Add timestamp and auto incrementing ID
This commit is contained in:
parent
5650e38e7d
commit
8e6a163f27
@ -33,6 +33,7 @@ class ReportEventRestServlet(RestServlet):
|
|||||||
super(ReportEventRestServlet, self).__init__()
|
super(ReportEventRestServlet, self).__init__()
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
|
self.clock = hs.get_clock()
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@ -48,6 +49,7 @@ class ReportEventRestServlet(RestServlet):
|
|||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
reason=body.get("reason"),
|
reason=body.get("reason"),
|
||||||
content=body,
|
content=body,
|
||||||
|
received_ts=self.clock.time_msec(),
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {}))
|
defer.returnValue((200, {}))
|
||||||
|
@ -114,6 +114,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||||||
self._state_groups_id_gen = StreamIdGenerator(db_conn, "state_groups", "id")
|
self._state_groups_id_gen = StreamIdGenerator(db_conn, "state_groups", "id")
|
||||||
self._access_tokens_id_gen = IdGenerator(db_conn, "access_tokens", "id")
|
self._access_tokens_id_gen = IdGenerator(db_conn, "access_tokens", "id")
|
||||||
self._refresh_tokens_id_gen = IdGenerator(db_conn, "refresh_tokens", "id")
|
self._refresh_tokens_id_gen = IdGenerator(db_conn, "refresh_tokens", "id")
|
||||||
|
self._event_reports_id_gen = IdGenerator(db_conn, "event_reports", "id")
|
||||||
self._push_rule_id_gen = IdGenerator(db_conn, "push_rules", "id")
|
self._push_rule_id_gen = IdGenerator(db_conn, "push_rules", "id")
|
||||||
self._push_rules_enable_id_gen = IdGenerator(db_conn, "push_rules_enable", "id")
|
self._push_rules_enable_id_gen = IdGenerator(db_conn, "push_rules_enable", "id")
|
||||||
self._push_rules_stream_id_gen = ChainedIdGenerator(
|
self._push_rules_stream_id_gen = ChainedIdGenerator(
|
||||||
|
@ -223,10 +223,14 @@ class RoomStore(SQLBaseStore):
|
|||||||
|
|
||||||
defer.returnValue((name, aliases))
|
defer.returnValue((name, aliases))
|
||||||
|
|
||||||
def add_event_report(self, room_id, event_id, user_id, reason, content):
|
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(
|
return self._simple_insert(
|
||||||
table="event_reports",
|
table="event_reports",
|
||||||
values={
|
values={
|
||||||
|
"id": next_id,
|
||||||
|
"received_ts": received_ts,
|
||||||
"room_id": room_id,
|
"room_id": room_id,
|
||||||
"event_id": event_id,
|
"event_id": event_id,
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
|
|
||||||
CREATE TABLE event_reports(
|
CREATE TABLE event_reports(
|
||||||
|
id BIGINT NOT NULL,
|
||||||
|
received_ts BIGINT NOT NULL,
|
||||||
room_id TEXT NOT NULL,
|
room_id TEXT NOT NULL,
|
||||||
event_id TEXT NOT NULL,
|
event_id TEXT NOT NULL,
|
||||||
user_id TEXT NOT NULL,
|
user_id TEXT NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user