From e5059fdf0f82b120c50ad2c9447726b7f9885ce2 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 14:14:00 -0600 Subject: [PATCH] Don't show Matrix-namespaced push rules which the server doesn't declare So that users can't change push rules they don't have. Similar to the behaviour in https://github.com/matrix-org/matrix-js-sdk/pull/860 --- src/components/views/settings/Notifications.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 4520f5c9a1..23f7cd484a 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -704,6 +704,10 @@ module.exports = React.createClass({ const rows = []; for (const i in this.state.vectorPushRules) { const rule = this.state.vectorPushRules[i]; + if (rule.rule === undefined && rule.vectorRuleId.startsWith(".m.")) { + console.warn(`Skipping render of rule ${rule.vectorRuleId} due to no underlying rule`); + continue; + } //console.log("rendering: " + rule.description + ", " + rule.vectorRuleId + ", " + rule.vectorState); rows.push(this.renderNotifRulesTableRow(rule.description, rule.vectorRuleId, rule.vectorState)); }