From bcd4ad130c8df3d6c1d25e98c278cc75b62e501a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 4 Mar 2019 21:25:04 -0700 Subject: [PATCH] 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. --- src/pushprocessor.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pushprocessor.js b/src/pushprocessor.js index 712c45399..445fce4be 100644 --- a/src/pushprocessor.js +++ b/src/pushprocessor.js @@ -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; }