1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Use the decrypted event content when checking the push rules

Otherwise we'll be looking at the encrypted source, and that doesn't help anyone.
This commit is contained in:
Travis Ralston
2019-03-04 21:25:04 -07:00
parent 998d9e010e
commit bcd4ad130c

View File

@@ -184,7 +184,16 @@ function PushProcessor(client) {
};
const eventFulfillsDisplayNameCondition = function(cond, ev) {
const content = ev.getContent();
let content = ev.getContent();
// TODO: Don't use private variable access
if (ev.isEncrypted() && ev._clearEvent) {
// Sometimes the event content is nested for some reason, so unpack that.
if (ev._clearEvent.content) {
content = ev._clearEvent.content;
} else {
content = ev._clearEvent;
}
}
if (!content || !content.body || typeof content.body != 'string') {
return false;
}