From 07c267c51676fe1df80993da6700f35e69fe6761 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Tue, 27 Aug 2019 14:34:05 +0100 Subject: [PATCH] For user stats, handle other membership transitions properly. Signed-off-by: Olivier Wilkinson (reivilibre) --- synapse/handlers/stats.py | 5 ++--- synapse/storage/stats.py | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/synapse/handlers/stats.py b/synapse/handlers/stats.py index f065d88a7d..2f7c108181 100644 --- a/synapse/handlers/stats.py +++ b/synapse/handlers/stats.py @@ -219,9 +219,8 @@ class StatsHandler(StateDeltasHandler): user_id = state_key if self.is_mine_id(user_id): # this accounts for transitions like leave → ban and so on. - has_changed_joinedness = ( - (prev_membership == Membership.JOIN) != - (membership == Membership.JOIN) + has_changed_joinedness = (prev_membership == Membership.JOIN) != ( + membership == Membership.JOIN ) if has_changed_joinedness: diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py index 6832ec6b7f..f86e9bd269 100644 --- a/synapse/storage/stats.py +++ b/synapse/storage/stats.py @@ -15,12 +15,9 @@ # limitations under the License. import logging +from itertools import chain from threading import Lock -from twisted.internet import defer -from itertools import chain - -from synapse.storage.state_deltas import StateDeltasStore from synapse.storage.state_deltas import StateDeltasStore from synapse.util.caches.descriptors import cached