diff options
author | Daniel Wagner-Hall <daniel@matrix.org> | 2016-02-16 14:25:23 +0000 |
---|---|---|
committer | Daniel Wagner-Hall <daniel@matrix.org> | 2016-02-16 14:25:23 +0000 |
commit | d1fb790818e0b93019850ca5db3ffba2baddc745 (patch) | |
tree | 45e0eb29d71557fd79df56d2bae45ff9d296ba22 /synapse/handlers/message.py | |
parent | Tidy? up room creation event sending (diff) | |
download | synapse-d1fb790818e0b93019850ca5db3ffba2baddc745.tar.xz |
Some cleanup
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 05dab172b8..9c3471f2e3 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -253,12 +253,18 @@ class MessageHandler(BaseHandler): presence.bump_presence_active_time(user) def deduplicate_state_event(self, event, context): - prev_state = context.current_state.get((event.type, event.state_key)) - if prev_state and event.user_id == prev_state.user_id: - prev_content = encode_canonical_json(prev_state.content) + """ + Checks whether event is in the latest resolved state in context. + + If so, returns the version of the event in context. + Otherwise, returns None. + """ + prev_event = context.current_state.get((event.type, event.state_key)) + if prev_event and event.user_id == prev_event.user_id: + prev_content = encode_canonical_json(prev_event.content) next_content = encode_canonical_json(event.content) if prev_content == next_content: - return prev_state + return prev_event return None @defer.inlineCallbacks |