From 9b42fbe42f41aa4b1aa6b231383be78639bbec57 Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 27 Feb 2017 15:32:58 -0700 Subject: [PATCH 1/2] Expose notification option for username/MXID For those unfortunate people that get pinged constantly. --- src/components/views/settings/Notifications.js | 3 ++- src/notifications/VectorPushRulesDefinitions.js | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index eace048afd..506b34df52 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -458,8 +458,8 @@ module.exports = React.createClass({ '.m.rule.master': 'master', // The default push rules displayed by Vector UI - // XXX: .m.rule.contains_user_name is not managed (not a fancy rule for Vector?) '.m.rule.contains_display_name': 'vector', + '.m.rule.contains_user_name': 'vector', '.m.rule.room_one_to_one': 'vector', '.m.rule.message': 'vector', '.m.rule.invite_for_me': 'vector', @@ -512,6 +512,7 @@ module.exports = React.createClass({ var vectorRuleIds = [ '.m.rule.contains_display_name', + '.m.rule.contains_user_name', '_keywords', '.m.rule.room_one_to_one', '.m.rule.message', diff --git a/src/notifications/VectorPushRulesDefinitions.js b/src/notifications/VectorPushRulesDefinitions.js index 2e90e576ba..172a7f3af2 100644 --- a/src/notifications/VectorPushRulesDefinitions.js +++ b/src/notifications/VectorPushRulesDefinitions.js @@ -63,10 +63,20 @@ class VectorPushRuleDefinition { */ module.exports = { // Messages containing user's display name - // (skip contains_user_name which is too geeky) ".m.rule.contains_display_name": new VectorPushRuleDefinition({ kind: "override", - description: "Messages containing my name", + description: "Messages containing my display name", + vectorStateToActions: { // The actions for each vector state, or null to disable the rule. + on: StandardActions.ACTION_NOTIFY, + loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND, + off: StandardActions.ACTION_DISABLED + } + }), + + // Messages containing user's username (localpart/MXID) + ".m.rule.contains_user_name": new VectorPushRuleDefinition({ + kind: "override", + description: "Messages containing my username", vectorStateToActions: { // The actions for each vector state, or null to disable the rule. on: StandardActions.ACTION_NOTIFY, loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND, From 9afbe8e3fc1852951387e15a4ba09bec275aca58 Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 27 Feb 2017 15:47:21 -0700 Subject: [PATCH 2/2] Change wording in notification description --- src/notifications/VectorPushRulesDefinitions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notifications/VectorPushRulesDefinitions.js b/src/notifications/VectorPushRulesDefinitions.js index 172a7f3af2..d696451d56 100644 --- a/src/notifications/VectorPushRulesDefinitions.js +++ b/src/notifications/VectorPushRulesDefinitions.js @@ -76,7 +76,7 @@ module.exports = { // Messages containing user's username (localpart/MXID) ".m.rule.contains_user_name": new VectorPushRuleDefinition({ kind: "override", - description: "Messages containing my username", + description: "Messages containing my user name", vectorStateToActions: { // The actions for each vector state, or null to disable the rule. on: StandardActions.ACTION_NOTIFY, loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,