Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fill in the 'default' field for user-defined push rules #6639

Merged
merged 2 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6639.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missing field `default` when fetching user-defined push rules.
1 change: 1 addition & 0 deletions synapse/storage/data_stores/main/push_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _load_rules(rawrules, enabled_map):
rule = dict(rawrule)
rule["conditions"] = json.loads(rawrule["conditions"])
rule["actions"] = json.loads(rawrule["actions"])
rule["default"] = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec defines this as Whether this is a default rule, or has been set explicitly.

If I understand the code correctly, push rules are only entered into the DB if they're explicitly set by a user, so indeed this should always be False.

ruleslist.append(rule)

# We're going to be mutating this a lot, so do a deep copy
Expand Down