From f8d21e1431ce08b267f7b63a0a0772beb2588f25 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Thu, 18 Feb 2016 11:02:14 +0000 Subject: [PATCH] Review comments --- synapse/handlers/_base.py | 3 ++- synapse/handlers/message.py | 2 +- synapse/handlers/room.py | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py index 41e153c934..a516a84a66 100644 --- a/synapse/handlers/_base.py +++ b/synapse/handlers/_base.py @@ -222,7 +222,8 @@ class BaseHandler(object): if event_type == EventTypes.Member ] if len(room_members) == 0: - # has the room been created so we can join it? + # Have we just created the room, and is this about to be the very + # first member event? create_event = current_state.get(("m.room.create", "")) if create_event: return True diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 9c3471f2e3..723bc0e34f 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -229,7 +229,7 @@ class MessageHandler(BaseHandler): if event.type == EventTypes.Member: raise SynapseError( 500, - "Tried to send member even through non-member codepath" + "Tried to send member event through non-member codepath" ) user = UserID.from_string(event.sender) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index cd04ac09fa..b00cac4bd4 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -490,11 +490,10 @@ class RoomMemberHandler(BaseHandler): sender = UserID.from_string(event.sender) assert self.hs.is_mine(sender), "Sender must be our own: %s" % (sender,) - if event.is_state(): - message_handler = self.hs.get_handlers().message_handler - prev_event = message_handler.deduplicate_state_event(event, context) - if prev_event is not None: - return + message_handler = self.hs.get_handlers().message_handler + prev_event = message_handler.deduplicate_state_event(event, context) + if prev_event is not None: + return action = "send"