mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Get current member state from current_state snapshot. Fix leave test.
This commit is contained in:
parent
57e0e619f3
commit
65cdf4e724
@ -343,9 +343,9 @@ class RoomMemberHandler(BaseHandler):
|
|||||||
"""
|
"""
|
||||||
target_user_id = event.state_key
|
target_user_id = event.state_key
|
||||||
|
|
||||||
# TODO(markjh): get prev state from snapshot.
|
prev_state = context.current_state.get(
|
||||||
prev_state = yield self.store.get_room_member(
|
(RoomMemberEvent.TYPE, target_user_id),
|
||||||
target_user_id, event.room_id
|
None
|
||||||
)
|
)
|
||||||
|
|
||||||
room_id = event.room_id
|
room_id = event.room_id
|
||||||
|
@ -270,7 +270,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
|||||||
(RoomMemberEvent.TYPE, "@bob:red"): self._create_member(
|
(RoomMemberEvent.TYPE, "@bob:red"): self._create_member(
|
||||||
user_id="@bob:red",
|
user_id="@bob:red",
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
membership=Membership.INVITE
|
membership=Membership.JOIN
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,6 +297,17 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
|||||||
# Actual invocation
|
# Actual invocation
|
||||||
yield room_handler.change_membership(event, context)
|
yield room_handler.change_membership(event, context)
|
||||||
|
|
||||||
|
self.federation.handle_new_event.assert_called_once_with(
|
||||||
|
event, None, destinations=set(['red'])
|
||||||
|
)
|
||||||
|
|
||||||
|
self.datastore.persist_event.assert_called_once_with(
|
||||||
|
event, context=context
|
||||||
|
)
|
||||||
|
self.notifier.on_new_room_event.assert_called_once_with(
|
||||||
|
event, extra_users=[user]
|
||||||
|
)
|
||||||
|
|
||||||
leave_signal_observer.assert_called_with(
|
leave_signal_observer.assert_called_with(
|
||||||
user=user, room_id=room_id
|
user=user, room_id=room_id
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user