For user stats, handle other membership transitions properly.

Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
This commit is contained in:
Olivier Wilkinson (reivilibre) 2019-08-27 14:34:05 +01:00
parent dd8e6020d8
commit 07c267c516
2 changed files with 3 additions and 7 deletions

View file

@ -219,9 +219,8 @@ class StatsHandler(StateDeltasHandler):
user_id = state_key user_id = state_key
if self.is_mine_id(user_id): if self.is_mine_id(user_id):
# this accounts for transitions like leave → ban and so on. # this accounts for transitions like leave → ban and so on.
has_changed_joinedness = ( has_changed_joinedness = (prev_membership == Membership.JOIN) != (
(prev_membership == Membership.JOIN) != membership == Membership.JOIN
(membership == Membership.JOIN)
) )
if has_changed_joinedness: if has_changed_joinedness:

View file

@ -15,12 +15,9 @@
# limitations under the License. # limitations under the License.
import logging import logging
from itertools import chain
from threading import Lock 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.storage.state_deltas import StateDeltasStore
from synapse.util.caches.descriptors import cached from synapse.util.caches.descriptors import cached