Fix bug where we superfluously asked for current state. Change API of /query_auth/ so that we don't duplicate events in the response.

This commit is contained in:
Erik Johnston 2015-01-30 13:34:01 +00:00
parent 0adf3e5445
commit a70a801184
5 changed files with 43 additions and 49 deletions

View file

@ -166,10 +166,17 @@ class StateHandler(object):
first is the name of a state group if one and only one is involved,
otherwise `None`.
"""
logger.debug("resolve_state_groups event_ids %s", event_ids)
state_groups = yield self.store.get_state_groups(
event_ids
)
logger.debug(
"resolve_state_groups state_groups %s",
state_groups.keys()
)
group_names = set(state_groups.keys())
if len(group_names) == 1:
name, state_list = state_groups.items().pop()
@ -205,6 +212,15 @@ class StateHandler(object):
if len(v.values()) > 1
}
logger.debug(
"resolve_state_groups Unconflicted state: %s",
unconflicted_state.values(),
)
logger.debug(
"resolve_state_groups Conflicted state: %s",
conflicted_state.values(),
)
if event_type:
prev_states_events = conflicted_state.get(
(event_type, state_key), []
@ -240,10 +256,6 @@ class StateHandler(object):
1. power levels
2. memberships
3. other events.
:param conflicted_state:
:param auth_events:
:return:
"""
resolved_state = {}
power_key = (EventTypes.PowerLevels, "")