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

Fix sender_notification_permission cond

Don't assume all events have a sender, because they don't.
This commit is contained in:
David Baker
2017-10-25 11:10:55 +01:00
parent da7104b00d
commit 37ed9800c5

View File

@@ -158,6 +158,14 @@ function PushProcessor(client) {
notifLevel = powerLevels.getContent().notifications[notifLevelKey];
}
// This cannot be assumed to always be set for state events
// (in particular it is never set for the room creation event
// because it preceeds the join event of the sender).
// In these cases, this condition cannot match.
if (ev.sender === null) {
return false;
}
return ev.sender.powerLevel >= notifLevel;
};