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
pull/21833/head
Travis Ralston 2019-03-15 14:14:00 -06:00
parent 8d8445429c
commit e5059fdf0f
1 changed files with 4 additions and 0 deletions

View File

@ -704,6 +704,10 @@ module.exports = React.createClass({
const rows = []; const rows = [];
for (const i in this.state.vectorPushRules) { for (const i in this.state.vectorPushRules) {
const rule = this.state.vectorPushRules[i]; 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); //console.log("rendering: " + rule.description + ", " + rule.vectorRuleId + ", " + rule.vectorState);
rows.push(this.renderNotifRulesTableRow(rule.description, rule.vectorRuleId, rule.vectorState)); rows.push(this.renderNotifRulesTableRow(rule.description, rule.vectorRuleId, rule.vectorState));
} }