mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Don't generate room membership messages. Include previous state of in membership messages.
This commit is contained in:
parent
2ffb075772
commit
849627b82e
@ -506,18 +506,21 @@ class RoomMemberHandler(BaseHandler):
|
|||||||
SynapseError if there was a problem changing the membership.
|
SynapseError if there was a problem changing the membership.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# broadcast_msg = False
|
broadcast_msg = False
|
||||||
|
|
||||||
prev_state = yield self.store.get_room_member(
|
prev_state = yield self.store.get_room_member(
|
||||||
event.target_user_id, event.room_id
|
event.target_user_id, event.room_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if prev_state and prev_state.membership == event.membership:
|
if prev_state:
|
||||||
# treat this event as a NOOP.
|
event.content["prev"] = prev_state.membership
|
||||||
if do_auth: # This is mainly to fix a unit test.
|
|
||||||
yield self.auth.check(event, raises=True)
|
# if prev_state and prev_state.membership == event.membership:
|
||||||
defer.returnValue({})
|
# # treat this event as a NOOP.
|
||||||
return
|
# if do_auth: # This is mainly to fix a unit test.
|
||||||
|
# yield self.auth.check(event, raises=True)
|
||||||
|
# defer.returnValue({})
|
||||||
|
# return
|
||||||
|
|
||||||
room_id = event.room_id
|
room_id = event.room_id
|
||||||
|
|
||||||
|
@ -794,7 +794,12 @@ class RoomMemberStateTestCase(RestTestCase):
|
|||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET", path, None)
|
(code, response) = yield self.mock_resource.trigger("GET", path, None)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
self.assertEquals(json.loads(content), response)
|
|
||||||
|
expected_response = {
|
||||||
|
"membership": Membership.JOIN,
|
||||||
|
"prev": Membership.JOIN,
|
||||||
|
}
|
||||||
|
self.assertEquals(expected_response, response)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_rooms_members_other(self):
|
def test_rooms_members_other(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user