Remove unused function. Add comment.

pull/39/head
Erik Johnston 2015-01-21 16:44:04 +00:00
parent 6dcade97be
commit b390bf39f2
1 changed files with 12 additions and 16 deletions

View File

@ -231,24 +231,20 @@ class StateHandler(object):
defer.returnValue((None, new_state, prev_states)) defer.returnValue((None, new_state, prev_states))
def _get_power_level_from_event_state(self, event, user_id):
if hasattr(event, "old_state_events") and event.old_state_events:
key = (EventTypes.PowerLevels, "", )
power_level_event = event.old_state_events.get(key)
level = None
if power_level_event:
level = power_level_event.content.get("users", {}).get(
user_id
)
if not level:
level = power_level_event.content.get("users_default", 0)
return level
else:
return 0
@log_function @log_function
def _resolve_state_events(self, conflicted_state, auth_events): def _resolve_state_events(self, conflicted_state, auth_events):
""" This is where we actually decide which of the conflicted state to
use.
We resolve conflicts in the following order:
1. power levels
2. memberships
3. other events.
:param conflicted_state:
:param auth_events:
:return:
"""
resolved_state = {} resolved_state = {}
power_key = (EventTypes.PowerLevels, "") power_key = (EventTypes.PowerLevels, "")
if power_key in conflicted_state.items(): if power_key in conflicted_state.items():