Merge pull request #5998 from matrix-org/erikj/fixup_federate_flag

Correctly handle non-bool m.federate flag
This commit is contained in:
Erik Johnston 2019-09-06 15:32:43 +01:00 committed by GitHub
commit a2a695b7ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

1
changelog.d/5998.bugfix Normal file
View File

@ -0,0 +1 @@
Fix room and user stats tracking.

View File

@ -260,7 +260,9 @@ class StatsHandler(StateDeltasHandler):
room_stats_delta["local_users_in_room"] += delta room_stats_delta["local_users_in_room"] += delta
elif typ == EventTypes.Create: elif typ == EventTypes.Create:
room_state["is_federatable"] = event_content.get("m.federate", True) room_state["is_federatable"] = (
event_content.get("m.federate", True) is True
)
if sender and self.is_mine_id(sender): if sender and self.is_mine_id(sender):
user_to_stats_deltas.setdefault(sender, Counter())[ user_to_stats_deltas.setdefault(sender, Counter())[
"rooms_created" "rooms_created"

View File

@ -823,7 +823,9 @@ class StatsStore(StateDeltasStore):
elif event.type == EventTypes.CanonicalAlias: elif event.type == EventTypes.CanonicalAlias:
room_state["canonical_alias"] = event.content.get("alias") room_state["canonical_alias"] = event.content.get("alias")
elif event.type == EventTypes.Create: elif event.type == EventTypes.Create:
room_state["is_federatable"] = event.content.get("m.federate", True) room_state["is_federatable"] = (
event.content.get("m.federate", True) is True
)
yield self.update_room_state(room_id, room_state) yield self.update_room_state(room_id, room_state)