mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-29 18:36:12 -05:00
Merge pull request #4837 from matrix-org/erikj/optional_prev_state
Make `prev_state` field optional
This commit is contained in:
commit
ca7f7d84f4
1
changelog.d/4837.bugfix
Normal file
1
changelog.d/4837.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix bug where synapse expected an un-specced `prev_state` field on state events.
|
@ -141,7 +141,6 @@ class EventBase(object):
|
|||||||
origin = _event_dict_property("origin")
|
origin = _event_dict_property("origin")
|
||||||
origin_server_ts = _event_dict_property("origin_server_ts")
|
origin_server_ts = _event_dict_property("origin_server_ts")
|
||||||
prev_events = _event_dict_property("prev_events")
|
prev_events = _event_dict_property("prev_events")
|
||||||
prev_state = _event_dict_property("prev_state")
|
|
||||||
redacts = _event_dict_property("redacts")
|
redacts = _event_dict_property("redacts")
|
||||||
room_id = _event_dict_property("room_id")
|
room_id = _event_dict_property("room_id")
|
||||||
sender = _event_dict_property("sender")
|
sender = _event_dict_property("sender")
|
||||||
|
@ -1407,21 +1407,6 @@ class EventsStore(StateGroupWorkerStore, EventFederationStore, EventsWorkerStore
|
|||||||
values=state_values,
|
values=state_values,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._simple_insert_many_txn(
|
|
||||||
txn,
|
|
||||||
table="event_edges",
|
|
||||||
values=[
|
|
||||||
{
|
|
||||||
"event_id": event.event_id,
|
|
||||||
"prev_event_id": prev_id,
|
|
||||||
"room_id": event.room_id,
|
|
||||||
"is_state": True,
|
|
||||||
}
|
|
||||||
for event, _ in state_events_and_contexts
|
|
||||||
for prev_id, _ in event.prev_state
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Prefill the event cache
|
# Prefill the event cache
|
||||||
self._add_to_cache(txn, events_and_contexts)
|
self._add_to_cache(txn, events_and_contexts)
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ CREATE TABLE IF NOT EXISTS event_edges(
|
|||||||
event_id TEXT NOT NULL,
|
event_id TEXT NOT NULL,
|
||||||
prev_event_id TEXT NOT NULL,
|
prev_event_id TEXT NOT NULL,
|
||||||
room_id TEXT NOT NULL,
|
room_id TEXT NOT NULL,
|
||||||
|
-- We no longer insert prev_state into this table, so all new rows will have
|
||||||
|
-- is_state as false.
|
||||||
is_state BOOL NOT NULL,
|
is_state BOOL NOT NULL,
|
||||||
UNIQUE (event_id, prev_event_id, room_id, is_state)
|
UNIQUE (event_id, prev_event_id, room_id, is_state)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user