mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Rename annotate_state_groups to annotate_event_with_state
This commit is contained in:
parent
a8ceeec0fd
commit
3db2c0d43e
@ -64,7 +64,7 @@ class BaseHandler(object):
|
|||||||
|
|
||||||
snapshot.fill_out_prev_events(event)
|
snapshot.fill_out_prev_events(event)
|
||||||
|
|
||||||
yield self.state_handler.annotate_state_groups(event)
|
yield self.state_handler.annotate_event_with_state(event)
|
||||||
|
|
||||||
yield self.auth.add_auth_events(event)
|
yield self.auth.add_auth_events(event)
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class FederationHandler(BaseHandler):
|
|||||||
if state:
|
if state:
|
||||||
state = [self.pdu_codec.event_from_pdu(p) for p in state]
|
state = [self.pdu_codec.event_from_pdu(p) for p in state]
|
||||||
|
|
||||||
is_new_state = yield self.state_handler.annotate_state_groups(
|
is_new_state = yield self.state_handler.annotate_event_with_state(
|
||||||
event,
|
event,
|
||||||
old_state=state
|
old_state=state
|
||||||
)
|
)
|
||||||
@ -202,7 +202,7 @@ class FederationHandler(BaseHandler):
|
|||||||
event = self.pdu_codec.event_from_pdu(pdu)
|
event = self.pdu_codec.event_from_pdu(pdu)
|
||||||
|
|
||||||
# FIXME (erikj): Not sure this actually works :/
|
# FIXME (erikj): Not sure this actually works :/
|
||||||
yield self.state_handler.annotate_state_groups(event)
|
yield self.state_handler.annotate_event_with_state(event)
|
||||||
|
|
||||||
events.append(event)
|
events.append(event)
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ class FederationHandler(BaseHandler):
|
|||||||
|
|
||||||
logger.debug("do_invite_join state: %s", state)
|
logger.debug("do_invite_join state: %s", state)
|
||||||
|
|
||||||
is_new_state = yield self.state_handler.annotate_state_groups(
|
is_new_state = yield self.state_handler.annotate_event_with_state(
|
||||||
event,
|
event,
|
||||||
old_state=state
|
old_state=state
|
||||||
)
|
)
|
||||||
@ -289,7 +289,7 @@ class FederationHandler(BaseHandler):
|
|||||||
# FIXME: Auth these.
|
# FIXME: Auth these.
|
||||||
e.outlier = True
|
e.outlier = True
|
||||||
|
|
||||||
yield self.state_handler.annotate_state_groups(
|
yield self.state_handler.annotate_event_with_state(
|
||||||
e,
|
e,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ class FederationHandler(BaseHandler):
|
|||||||
snapshot = yield self.store.snapshot_room(event)
|
snapshot = yield self.store.snapshot_room(event)
|
||||||
snapshot.fill_out_prev_events(event)
|
snapshot.fill_out_prev_events(event)
|
||||||
|
|
||||||
yield self.state_handler.annotate_state_groups(event)
|
yield self.state_handler.annotate_event_with_state(event)
|
||||||
yield self.auth.add_auth_events(event)
|
yield self.auth.add_auth_events(event)
|
||||||
self.auth.check(event, raises=True)
|
self.auth.check(event, raises=True)
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ class FederationHandler(BaseHandler):
|
|||||||
|
|
||||||
event.outlier = False
|
event.outlier = False
|
||||||
|
|
||||||
is_new_state = yield self.state_handler.annotate_state_groups(event)
|
is_new_state = yield self.state_handler.annotate_event_with_state(event)
|
||||||
self.auth.check(event, raises=True)
|
self.auth.check(event, raises=True)
|
||||||
|
|
||||||
# FIXME (erikj): All this is duplicated above :(
|
# FIXME (erikj): All this is duplicated above :(
|
||||||
@ -421,7 +421,7 @@ class FederationHandler(BaseHandler):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.state_handler.annotate_state_groups(event)
|
yield self.state_handler.annotate_event_with_state(event)
|
||||||
|
|
||||||
yield self.store.persist_event(
|
yield self.store.persist_event(
|
||||||
event,
|
event,
|
||||||
|
@ -45,7 +45,7 @@ class StateHandler(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@log_function
|
@log_function
|
||||||
def annotate_state_groups(self, event, old_state=None):
|
def annotate_event_with_state(self, event, old_state=None):
|
||||||
yield run_on_reactor()
|
yield run_on_reactor()
|
||||||
|
|
||||||
if old_state:
|
if old_state:
|
||||||
|
@ -36,7 +36,7 @@ class FederationTestCase(unittest.TestCase):
|
|||||||
self.mock_config.signing_key = [MockKey()]
|
self.mock_config.signing_key = [MockKey()]
|
||||||
|
|
||||||
self.state_handler = NonCallableMock(spec_set=[
|
self.state_handler = NonCallableMock(spec_set=[
|
||||||
"annotate_state_groups",
|
"annotate_event_with_state",
|
||||||
])
|
])
|
||||||
|
|
||||||
self.auth = NonCallableMock(spec_set=[
|
self.auth = NonCallableMock(spec_set=[
|
||||||
@ -85,7 +85,7 @@ class FederationTestCase(unittest.TestCase):
|
|||||||
self.datastore.persist_event.return_value = defer.succeed(None)
|
self.datastore.persist_event.return_value = defer.succeed(None)
|
||||||
self.datastore.get_room.return_value = defer.succeed(True)
|
self.datastore.get_room.return_value = defer.succeed(True)
|
||||||
|
|
||||||
self.state_handler.annotate_state_groups.return_value = (
|
self.state_handler.annotate_event_with_state.return_value = (
|
||||||
defer.succeed(False)
|
defer.succeed(False)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class FederationTestCase(unittest.TestCase):
|
|||||||
ANY, False, is_new_state=False
|
ANY, False, is_new_state=False
|
||||||
)
|
)
|
||||||
|
|
||||||
self.state_handler.annotate_state_groups.assert_called_once_with(
|
self.state_handler.annotate_event_with_state.assert_called_once_with(
|
||||||
ANY,
|
ANY,
|
||||||
old_state=None,
|
old_state=None,
|
||||||
)
|
)
|
||||||
|
@ -60,7 +60,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
|||||||
]),
|
]),
|
||||||
auth=NonCallableMock(spec_set=["check", "add_auth_events"]),
|
auth=NonCallableMock(spec_set=["check", "add_auth_events"]),
|
||||||
state_handler=NonCallableMock(spec_set=[
|
state_handler=NonCallableMock(spec_set=[
|
||||||
"annotate_state_groups",
|
"annotate_event_with_state",
|
||||||
]),
|
]),
|
||||||
config=self.mock_config,
|
config=self.mock_config,
|
||||||
)
|
)
|
||||||
@ -251,7 +251,7 @@ class RoomCreationTest(unittest.TestCase):
|
|||||||
]),
|
]),
|
||||||
auth=NonCallableMock(spec_set=["check", "add_auth_events"]),
|
auth=NonCallableMock(spec_set=["check", "add_auth_events"]),
|
||||||
state_handler=NonCallableMock(spec_set=[
|
state_handler=NonCallableMock(spec_set=[
|
||||||
"annotate_state_groups",
|
"annotate_event_with_state",
|
||||||
]),
|
]),
|
||||||
ratelimiter=NonCallableMock(spec_set=[
|
ratelimiter=NonCallableMock(spec_set=[
|
||||||
"send_message",
|
"send_message",
|
||||||
@ -282,7 +282,7 @@ class RoomCreationTest(unittest.TestCase):
|
|||||||
def annotate(event):
|
def annotate(event):
|
||||||
event.state_events = {}
|
event.state_events = {}
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
self.state_handler.annotate_state_groups.side_effect = annotate
|
self.state_handler.annotate_event_with_state.side_effect = annotate
|
||||||
|
|
||||||
def hosts(room):
|
def hosts(room):
|
||||||
return defer.succeed([])
|
return defer.succeed([])
|
||||||
@ -311,6 +311,6 @@ class RoomCreationTest(unittest.TestCase):
|
|||||||
self.assertEquals(user_id, join_event.user_id)
|
self.assertEquals(user_id, join_event.user_id)
|
||||||
self.assertEquals(user_id, join_event.state_key)
|
self.assertEquals(user_id, join_event.state_key)
|
||||||
|
|
||||||
self.assertTrue(self.state_handler.annotate_state_groups.called)
|
self.assertTrue(self.state_handler.annotate_event_with_state.called)
|
||||||
|
|
||||||
self.assertTrue(self.federation.handle_new_event.called)
|
self.assertTrue(self.federation.handle_new_event.called)
|
||||||
|
@ -44,7 +44,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
self.create_event(type="test2", state_key=""),
|
self.create_event(type="test2", state_key=""),
|
||||||
]
|
]
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event, old_state=old_state)
|
yield self.state.annotate_event_with_state(event, old_state=old_state)
|
||||||
|
|
||||||
for k, v in event.old_state_events.items():
|
for k, v in event.old_state_events.items():
|
||||||
type, state_key = k
|
type, state_key = k
|
||||||
@ -66,7 +66,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
self.create_event(type="test2", state_key=""),
|
self.create_event(type="test2", state_key=""),
|
||||||
]
|
]
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event, old_state=old_state)
|
yield self.state.annotate_event_with_state(event, old_state=old_state)
|
||||||
|
|
||||||
for k, v in event.old_state_events.items():
|
for k, v in event.old_state_events.items():
|
||||||
type, state_key = k
|
type, state_key = k
|
||||||
@ -99,7 +99,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
group_name: old_state,
|
group_name: old_state,
|
||||||
}
|
}
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event)
|
yield self.state.annotate_event_with_state(event)
|
||||||
|
|
||||||
for k, v in event.old_state_events.items():
|
for k, v in event.old_state_events.items():
|
||||||
type, state_key = k
|
type, state_key = k
|
||||||
@ -141,7 +141,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
group_name: old_state,
|
group_name: old_state,
|
||||||
}
|
}
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event)
|
yield self.state.annotate_event_with_state(event)
|
||||||
|
|
||||||
for k, v in event.old_state_events.items():
|
for k, v in event.old_state_events.items():
|
||||||
type, state_key = k
|
type, state_key = k
|
||||||
@ -199,7 +199,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
group_name_2: old_state_2,
|
group_name_2: old_state_2,
|
||||||
}
|
}
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event)
|
yield self.state.annotate_event_with_state(event)
|
||||||
|
|
||||||
self.assertEqual(len(event.old_state_events), 5)
|
self.assertEqual(len(event.old_state_events), 5)
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class StateTestCase(unittest.TestCase):
|
|||||||
group_name_2: old_state_2,
|
group_name_2: old_state_2,
|
||||||
}
|
}
|
||||||
|
|
||||||
yield self.state.annotate_state_groups(event)
|
yield self.state.annotate_event_with_state(event)
|
||||||
|
|
||||||
self.assertEqual(len(event.old_state_events), 5)
|
self.assertEqual(len(event.old_state_events), 5)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user