Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Support changing options for .m.rule.tombstone push rule #2798

Merged
merged 2 commits into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/views/settings/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ module.exports = React.createClass({
//'.m.rule.member_event': 'vector',
'.m.rule.call': 'vector',
'.m.rule.suppress_notices': 'vector',
'.m.rule.tombstone': 'vector',

// Others go to others
};
Expand Down Expand Up @@ -562,6 +563,7 @@ module.exports = React.createClass({
//'im.vector.rule.member_event',
'.m.rule.call',
'.m.rule.suppress_notices',
'.m.rule.tombstone',
];
for (const i in vectorRuleIds) {
const vectorRuleId = vectorRuleIds[i];
Expand Down Expand Up @@ -702,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));
}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"When I'm invited to a room": "When I'm invited to a room",
"Call invitation": "Call invitation",
"Messages sent by bot": "Messages sent by bot",
"When rooms are upgraded": "When rooms are upgraded",
"Active call (%(roomName)s)": "Active call (%(roomName)s)",
"unknown caller": "unknown caller",
"Incoming voice call from %(name)s": "Incoming voice call from %(name)s",
Expand Down
11 changes: 11 additions & 0 deletions src/notifications/VectorPushRulesDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,15 @@ module.exports = {
off: StandardActions.ACTION_DONT_NOTIFY,
},
}),

// Room upgrades (tombstones)
".m.rule.tombstone": new VectorPushRuleDefinition({
kind: "override",
description: _td("When rooms are upgraded"), // passed through _t() translation in src/components/views/settings/Notifications.js
vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_HIGHLIGHT,
off: StandardActions.ACTION_DISABLED,
},
}),
};