This commit is contained in:
Brendan Abolivier 2020-07-30 19:02:28 +01:00
parent 69158e554f
commit 60328ce9fb
No known key found for this signature in database
GPG Key ID: 1E015C145F1916CD

View File

@ -96,9 +96,17 @@ def make_base_append_rules(kind, modified_base_rules, use_new_defaults=False):
rules = [] rules = []
if kind == "override": if kind == "override":
rules = NEW_APPEND_OVERRIDE_RULES if use_new_defaults else BASE_APPEND_OVERRIDE_RULES rules = (
NEW_APPEND_OVERRIDE_RULES
if use_new_defaults
else BASE_APPEND_OVERRIDE_RULES
)
elif kind == "underride": elif kind == "underride":
rules = NEW_APPEND_UNDERRIDE_RULES if use_new_defaults else BASE_APPEND_UNDERRIDE_RULES rules = (
NEW_APPEND_UNDERRIDE_RULES
if use_new_defaults
else BASE_APPEND_UNDERRIDE_RULES
)
elif kind == "content": elif kind == "content":
rules = BASE_APPEND_CONTENT_RULES rules = BASE_APPEND_CONTENT_RULES
@ -117,7 +125,11 @@ def make_base_prepend_rules(kind, modified_base_rules, use_new_defaults=False):
rules = [] rules = []
if kind == "override": if kind == "override":
rules = NEW_PREPEND_OVERRIDE_RULES if use_new_defaults else BASE_PREPEND_OVERRIDE_RULES rules = (
NEW_PREPEND_OVERRIDE_RULES
if use_new_defaults
else BASE_PREPEND_OVERRIDE_RULES
)
# Copy the rules before modifying them # Copy the rules before modifying them
rules = copy.deepcopy(rules) rules = copy.deepcopy(rules)
@ -315,7 +327,7 @@ NEW_APPEND_OVERRIDE_RULES = [
"key": "content.msgtype", "key": "content.msgtype",
"pattern": "m.notice", "pattern": "m.notice",
"_id": "_suppress_notices", "_id": "_suppress_notices",
} },
], ],
"actions": [], "actions": [],
}, },
@ -348,10 +360,7 @@ NEW_APPEND_OVERRIDE_RULES = [
}, },
{"kind": "event_match", "key": "state_key", "pattern_type": "user_id"}, {"kind": "event_match", "key": "state_key", "pattern_type": "user_id"},
], ],
"actions": [ "actions": ["notify", {"set_tweak": "sound", "value": "default"}],
"notify",
{"set_tweak": "sound", "value": "default"},
],
}, },
{ {
"rule_id": "global/override/.m.rule.contains_display_name", "rule_id": "global/override/.m.rule.contains_display_name",
@ -415,11 +424,8 @@ NEW_APPEND_OVERRIDE_RULES = [
"_id": "_call", "_id": "_call",
} }
], ],
"actions": [ "actions": ["notify", {"set_tweak": "sound", "value": "ring"}],
"notify", },
{"set_tweak": "sound", "value": "ring"},
],
}
] ]
@ -512,17 +518,24 @@ NEW_APPEND_UNDERRIDE_RULES = [
"rule_id": "global/underride/.m.rule.room_one_to_one", "rule_id": "global/underride/.m.rule.room_one_to_one",
"conditions": [ "conditions": [
{"kind": "room_member_count", "is": "2", "_id": "member_count"}, {"kind": "room_member_count", "is": "2", "_id": "member_count"},
{"kind": "event_match", "key": "content.body", "pattern": "*", "_id": "body"}, {
], "kind": "event_match",
"actions": [ "key": "content.body",
"notify", "pattern": "*",
{"set_tweak": "sound", "value": "default"}, "_id": "body",
},
], ],
"actions": ["notify", {"set_tweak": "sound", "value": "default"}],
}, },
{ {
"rule_id": "global/underride/.m.rule.message", "rule_id": "global/underride/.m.rule.message",
"conditions": [ "conditions": [
{"kind": "event_match", "key": "content.body", "pattern": "*", "_id": "body"}, {
"kind": "event_match",
"key": "content.body",
"pattern": "*",
"_id": "body",
},
], ],
"actions": ["notify"], "actions": ["notify"],
"enabled": False, "enabled": False,