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
This commit is contained in:
Travis Ralston 2019-03-15 14:14:00 -06:00
parent 8d8445429c
commit e5059fdf0f

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));
} }