Add state_key and rejection_reason to events (#11792)

... and start populating them for new events
This commit is contained in:
Richard van der Hoff 2022-01-21 12:21:28 +00:00 committed by GitHub
parent b784299cbc
commit 2aa37a4250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 5 deletions

View file

@ -1389,6 +1389,8 @@ class PersistEventsStore:
"received_ts",
"sender",
"contains_url",
"state_key",
"rejection_reason",
),
values=(
(
@ -1405,8 +1407,10 @@ class PersistEventsStore:
self._clock.time_msec(),
event.sender,
"url" in event.content and isinstance(event.content["url"], str),
event.get_state_key(),
context.rejected or None,
)
for event, _ in events_and_contexts
for event, context in events_and_contexts
),
)
@ -1456,6 +1460,7 @@ class PersistEventsStore:
for event, context in events_and_contexts:
if context.rejected:
# Insert the event_id into the rejections table
# (events.rejection_reason has already been done)
self._store_rejections_txn(txn, event.event_id, context.rejected)
to_remove.add(event)