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

Commit efe2c6b

Browse files
committed
1 parent 020f15c commit efe2c6b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Notifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ const Notifier = {
348348
_evaluateEvent: function(ev) {
349349
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
350350
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
351-
if (actions && actions.notify) {
351+
if (actions && actions.notify && actions.push) {
352352
if (this.isEnabled()) {
353353
this._displayPopupNotification(ev, room);
354354
}

src/notifications/NotificationUtils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
module.exports = {
2020
// Encodes a dictionary of {
2121
// "notify": true/false,
22+
// "push": true/false,
2223
// "sound": string or undefined,
2324
// "highlight: true/false,
2425
// }
@@ -27,8 +28,12 @@ module.exports = {
2728
const notify = action.notify;
2829
const sound = action.sound;
2930
const highlight = action.highlight;
31+
const push = action.push;
3032
if (notify) {
3133
const actions = ["notify"];
34+
if (push === false) {
35+
actions.push("dont_push");
36+
}
3237
if (sound) {
3338
actions.push({"set_tweak": "sound", "value": sound});
3439
}
@@ -45,6 +50,7 @@ module.exports = {
4550

4651
// Decode a list of actions to a dictionary of {
4752
// "notify": true/false,
53+
// "push": true/false,
4854
// "sound": string or undefined,
4955
// "highlight: true/false,
5056
// }
@@ -53,13 +59,16 @@ module.exports = {
5359
let notify = false;
5460
let sound = null;
5561
let highlight = false;
62+
let push = true;
5663

5764
for (let i = 0; i < actions.length; ++i) {
5865
const action = actions[i];
5966
if (action === "notify") {
6067
notify = true;
6168
} else if (action === "dont_notify") {
6269
notify = false;
70+
} else if (action === "dont_push") {
71+
push = false;
6372
} else if (typeof action === 'object') {
6473
if (action.set_tweak === "sound") {
6574
sound = action.value;
@@ -80,7 +89,7 @@ module.exports = {
8089
highlight = true;
8190
}
8291

83-
const result = {notify: notify, highlight: highlight};
92+
const result = {notify: notify, highlight: highlight, push: push};
8493
if (sound !== null) {
8594
result.sound = sound;
8695
}

0 commit comments

Comments
 (0)