@@ -16,17 +16,7 @@ limitations under the License.
1616
1717'use strict';
1818
19- var NotificationUtils = require('./NotificationUtils');
20-
21- var encodeActions = NotificationUtils.encodeActions;
22- var decodeActions = NotificationUtils.decodeActions;
23-
24- const ACTION_NOTIFY = encodeActions({notify: true});
25- const ACTION_NOTIFY_DEFAULT_SOUND = encodeActions({notify: true, sound: "default"});
26- const ACTION_NOTIFY_RING_SOUND = encodeActions({notify: true, sound: "ring"});
27- const ACTION_HIGHLIGHT_DEFAULT_SOUND = encodeActions({notify: true, sound: "default", highlight: true});
28- const ACTION_DONT_NOTIFY = encodeActions({notify: false});
29- const ACTION_DISABLED = null;
19+ var StandardActions = require('./StandardActions');
3020
3121/**
3222 * The descriptions of rules managed by the Vector UI.
@@ -38,9 +28,9 @@ module.exports = {
3828 kind: "underride",
3929 description: "Messages containing my name",
4030 vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
41- on: ACTION_NOTIFY,
42- loud: ACTION_HIGHLIGHT_DEFAULT_SOUND,
43- off: ACTION_DISABLED
31+ on: StandardActions. ACTION_NOTIFY,
32+ loud: StandardActions. ACTION_HIGHLIGHT_DEFAULT_SOUND,
33+ off: StandardActions. ACTION_DISABLED
4434 }
4535 },
4636
@@ -49,9 +39,9 @@ module.exports = {
4939 kind: "underride",
5040 description: "Messages in one-to-one chats",
5141 vectorStateToActions: {
52- on: ACTION_NOTIFY,
53- loud: ACTION_NOTIFY_DEFAULT_SOUND,
54- off: ACTION_DONT_NOTIFY
42+ on: StandardActions. ACTION_NOTIFY,
43+ loud: StandardActions. ACTION_NOTIFY_DEFAULT_SOUND,
44+ off: StandardActions. ACTION_DONT_NOTIFY
5545 }
5646 },
5747
@@ -62,9 +52,9 @@ module.exports = {
6252 kind: "underride",
6353 description: "Messages in group chats",
6454 vectorStateToActions: {
65- on: ACTION_NOTIFY,
66- loud: ACTION_NOTIFY_DEFAULT_SOUND,
67- off: ACTION_DONT_NOTIFY
55+ on: StandardActions. ACTION_NOTIFY,
56+ loud: StandardActions. ACTION_NOTIFY_DEFAULT_SOUND,
57+ off: StandardActions. ACTION_DONT_NOTIFY
6858 }
6959 },
7060
@@ -73,9 +63,9 @@ module.exports = {
7363 kind: "underride",
7464 description: "When I'm invited to a room",
7565 vectorStateToActions: {
76- on: ACTION_NOTIFY,
77- loud: ACTION_NOTIFY_DEFAULT_SOUND,
78- off: ACTION_DISABLED
66+ on: StandardActions. ACTION_NOTIFY,
67+ loud: StandardActions. ACTION_NOTIFY_DEFAULT_SOUND,
68+ off: StandardActions. ACTION_DISABLED
7969 }
8070 },
8171
@@ -84,9 +74,9 @@ module.exports = {
8474 kind: "underride",
8575 description: "Call invitation",
8676 vectorStateToActions: {
87- on: ACTION_NOTIFY,
88- loud: ACTION_NOTIFY_RING_SOUND,
89- off: ACTION_DISABLED
77+ on: StandardActions. ACTION_NOTIFY,
78+ loud: StandardActions. ACTION_NOTIFY_RING_SOUND,
79+ off: StandardActions. ACTION_DISABLED
9080 }
9181 },
9282
@@ -96,9 +86,9 @@ module.exports = {
9686 description: "Messages sent by bot",
9787 vectorStateToActions: {
9888 // .m.rule.suppress_notices is a "negative" rule, we have to invert its enabled value for vector UI
99- on: ACTION_DISABLED,
100- loud: ACTION_NOTIFY_DEFAULT_SOUND,
101- off: ACTION_DONT_NOTIFY,
89+ on: StandardActions. ACTION_DISABLED,
90+ loud: StandardActions. ACTION_NOTIFY_DEFAULT_SOUND,
91+ off: StandardActions. ACTION_DONT_NOTIFY,
10292 }
10393 }
10494};
0 commit comments