@@ -69,7 +69,7 @@ def prepare(self, reactor, clock, homeserver):
6969 def persist_event (self , event , state = None ):
7070 """Persist the event, with optional state"""
7171 context = self .get_success (
72- self .state .compute_event_context (event , old_state = state )
72+ self .state .compute_event_context (event , state_ids_before_event = state )
7373 )
7474 self .get_success (self .persistence .persist_event (event , context ))
7575
@@ -103,9 +103,11 @@ def test_prune_gap(self):
103103 RoomVersions .V6 ,
104104 )
105105
106- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
106+ state_before_gap = self .get_success (
107+ self .state .get_current_state_ids (self .room_id )
108+ )
107109
108- self .persist_event (remote_event_2 , state = state_before_gap . values () )
110+ self .persist_event (remote_event_2 , state = state_before_gap )
109111
110112 # Check the new extremity is just the new remote event.
111113 self .assert_extremities ([remote_event_2 .event_id ])
@@ -135,13 +137,14 @@ def test_do_not_prune_gap_if_state_different(self):
135137 # setting. The state resolution across the old and new event will then
136138 # include it, and so the resolved state won't match the new state.
137139 state_before_gap = dict (
138- self .get_success (self .state .get_current_state (self .room_id ))
140+ self .get_success (self .state .get_current_state_ids (self .room_id ))
139141 )
140142 state_before_gap .pop (("m.room.history_visibility" , "" ))
141143
142144 context = self .get_success (
143145 self .state .compute_event_context (
144- remote_event_2 , old_state = state_before_gap .values ()
146+ remote_event_2 ,
147+ state_ids_before_event = state_before_gap ,
145148 )
146149 )
147150
@@ -177,9 +180,11 @@ def test_prune_gap_if_old(self):
177180 RoomVersions .V6 ,
178181 )
179182
180- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
183+ state_before_gap = self .get_success (
184+ self .state .get_current_state_ids (self .room_id )
185+ )
181186
182- self .persist_event (remote_event_2 , state = state_before_gap . values () )
187+ self .persist_event (remote_event_2 , state = state_before_gap )
183188
184189 # Check the new extremity is just the new remote event.
185190 self .assert_extremities ([remote_event_2 .event_id ])
@@ -207,9 +212,11 @@ def test_do_not_prune_gap_if_other_server(self):
207212 RoomVersions .V6 ,
208213 )
209214
210- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
215+ state_before_gap = self .get_success (
216+ self .state .get_current_state_ids (self .room_id )
217+ )
211218
212- self .persist_event (remote_event_2 , state = state_before_gap . values () )
219+ self .persist_event (remote_event_2 , state = state_before_gap )
213220
214221 # Check the new extremity is just the new remote event.
215222 self .assert_extremities ([self .remote_event_1 .event_id , remote_event_2 .event_id ])
@@ -247,9 +254,11 @@ def test_prune_gap_if_dummy_remote(self):
247254 RoomVersions .V6 ,
248255 )
249256
250- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
257+ state_before_gap = self .get_success (
258+ self .state .get_current_state_ids (self .room_id )
259+ )
251260
252- self .persist_event (remote_event_2 , state = state_before_gap . values () )
261+ self .persist_event (remote_event_2 , state = state_before_gap )
253262
254263 # Check the new extremity is just the new remote event.
255264 self .assert_extremities ([remote_event_2 .event_id ])
@@ -289,9 +298,11 @@ def test_prune_gap_if_dummy_local(self):
289298 RoomVersions .V6 ,
290299 )
291300
292- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
301+ state_before_gap = self .get_success (
302+ self .state .get_current_state_ids (self .room_id )
303+ )
293304
294- self .persist_event (remote_event_2 , state = state_before_gap . values () )
305+ self .persist_event (remote_event_2 , state = state_before_gap )
295306
296307 # Check the new extremity is just the new remote event.
297308 self .assert_extremities ([remote_event_2 .event_id , local_message_event_id ])
@@ -323,9 +334,11 @@ def test_do_not_prune_gap_if_not_dummy(self):
323334 RoomVersions .V6 ,
324335 )
325336
326- state_before_gap = self .get_success (self .state .get_current_state (self .room_id ))
337+ state_before_gap = self .get_success (
338+ self .state .get_current_state_ids (self .room_id )
339+ )
327340
328- self .persist_event (remote_event_2 , state = state_before_gap . values () )
341+ self .persist_event (remote_event_2 , state = state_before_gap )
329342
330343 # Check the new extremity is just the new remote event.
331344 self .assert_extremities ([local_message_event_id , remote_event_2 .event_id ])
0 commit comments