-
-
Notifications
You must be signed in to change notification settings - Fork 649
Closed
Description
I wanted to configure a pushrule ignoring "m.replace" events.
Therefore i used this configuration:
{
scope: 'global',
kind: 'override',
ruleId: 'rule.no_edits',
body: {
actions: [
'dont_notify'
],
conditions: [
{
'kind': 'event_match',
'key': 'type',
'pattern': 'm.room.message'
},
{
'kind': 'event_match',
'key': 'content.m.relates_to.rel_type',
'pattern': 'm.replace'
},
]
},
}
But the behaviour of Synapse and the matrix-js-sdk didn't match.
The condition key content.m.relates_to.rel_type is interpreted in the valueDottedForKey method wrong:
Actual part splitting:
['content', 'm', 'relates_to', 'rel_type']
Needed splitting:
['content', 'm.relates_to', 'rel_type']
https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/pushprocessor.js#L292
const parts = key.split('.');
Maybe the approach of just splitting by the dot is undesirable.
Synapse takes the apporach the other way around, converting the nested object to a flat object and afterwards just accessing by the key.
Pseudo:
function accessDottedKey(evt, key) {
flatEvt = makeFlat(evt);
return flatEvt[key];
}Metadata
Metadata
Assignees
Labels
No labels