Added messaging group/device notifications setup user interface.
Ylian Saint-Hilaire committed
Nov 1, 2022 at 20:32 UTC
2fa50796dac5406ae1cb554ec5246ab03d4d5553
1 file changed
+48
-6
views/default.handlebars
+48
-6
@@ -7281,9 +7281,14 @@
7281
if (devNotify & 4) { devNotifyStr.push("Disconnect"); }
7282
if ((node.intelamt != null) && (devNotify & 8)) { devNotifyStr.push("Intel® AMT"); }
7283
if ((features2 & 0x00004000) && (userinfo.emailVerified)) {
7284
- if (devNotify & 16) { devNotifyStr.push("Email Connect"); }
7285
- if (devNotify & 32) { devNotifyStr.push("Email Disconnect"); }
7286
- if (devNotify & 64) { devNotifyStr.push("Email Help Request"); }
7284
+ var xx = 0;
7285
+ if (devNotify & 16) { xx++; } if (devNotify & 32) { xx++; } if (devNotify & 64) { xx++; }
7286
+ if (xx > 0) { devNotifyStr.push(format("Email ({0})", xx)); }
7287
+ }
7288
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
7289
+ var xx = 0;
7290
+ if (devNotify & 128) { xx++; } if (devNotify & 256) { xx++; } if (devNotify & 512) { xx++; }
7291
+ if (xx > 0) { devNotifyStr.push(format("Messaging ({0})", xx)); }
7292
}
7293
}
7294
devNotifyStr = devNotifyStr.join(', ');
@@ -7714,6 +7719,12 @@
7719
x += '<div><label><input id=p20enotifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections" + '</label></div>';
7720
x += '<div><label><input id=p20enotifyIntelDeviceHelp type=checkbox />' + "Help requests" + '</label></div>';
7721
}
7722
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
7723
+ x += '<br /><div style="border-bottom: 1px solid #888;margin-bottom:3px">' + "Messaging Notifications" + '</div>';
7724
+ x += '<div><label><input id=p20emsgDeviceConnect type=checkbox />' + "Device connections" + '</label></div>';
7725
+ x += '<div><label><input id=p20emsgDeviceDisconnect type=checkbox />' + "Device disconnections" + '</label></div>';
7726
+ x += '<div><label><input id=p20emsgDeviceHelp type=checkbox />' + "Help requests" + '</label></div>';
7727
+ }
7728
setDialogMode(2, "Notification Settings", 3, p20editDeviceNotifyEx, x, fx);
7729
Q('p20notifyIntelDeviceConnect').checked = (devNotify & 2);
7730
Q('p20notifyIntelDeviceDisconnect').checked = (devNotify & 4);
@@ -7723,6 +7734,11 @@
7734
Q('p20enotifyIntelDeviceDisconnect').checked = (devNotify & 32);
7735
Q('p20enotifyIntelDeviceHelp').checked = (devNotify & 64);
7736
}
7737
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
7738
+ Q('p20emsgDeviceConnect').checked = (devNotify & 128);
7739
+ Q('p20emsgDeviceDisconnect').checked = (devNotify & 256);
7740
+ Q('p20emsgDeviceHelp').checked = (devNotify & 512);
7741
+ }
7742
return false;
7743
}
7744
@@ -7736,6 +7752,11 @@
7752
devNotify += Q('p20enotifyIntelDeviceDisconnect').checked ? 32 : 0;
7753
devNotify += Q('p20enotifyIntelDeviceHelp').checked ? 64 : 0;
7754
}
7755
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
7756
+ devNotify += Q('p20emsgDeviceConnect').checked ? 128 : 0;
7757
+ devNotify += Q('p20emsgDeviceDisconnect').checked ? 256 : 0;
7758
+ devNotify += Q('p20emsgDeviceHelp').checked ? 512 : 0;
7759
+ }
7760
meshserver.send({ action: 'changeusernotify', nodeid: currentNode._id, notify: devNotify });
7761
}
7762
@@ -12674,9 +12695,14 @@
12695
if (meshNotify & 4) { meshNotifyStr.push("Disconnect"); }
12696
if (meshNotify & 8) { meshNotifyStr.push("Intel® AMT"); }
12697
if ((features2 & 0x00004000) && (userinfo.emailVerified)) {
12677
- if (meshNotify & 16) { meshNotifyStr.push("Email Connect"); }
12678
- if (meshNotify & 32) { meshNotifyStr.push("Email Disconnect"); }
12679
- if (meshNotify & 64) { meshNotifyStr.push("Email Help Request"); }
12698
+ var xx = 0;
12699
+ if (meshNotify & 16) { xx++; } if (meshNotify & 32) { xx++; } if (meshNotify & 64) { xx++; }
12700
+ if (xx > 0) { meshNotifyStr.push(format("Email ({0})", xx)); }
12701
+ }
12702
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
12703
+ var xx = 0;
12704
+ if (meshNotify & 128) { xx++; } if (meshNotify & 256) { xx++; } if (meshNotify & 512) { xx++; }
12705
+ if (xx > 0) { meshNotifyStr.push(format("Messaging ({0})", xx)); }
12706
}
12707
if (meshNotifyStr.length == 0) { meshNotifyStr.push('<i>' + "None" + '</i>'); }
12708
x += addHtmlValue("Notifications", addLink(meshNotifyStr.join(', '), 'p20editMeshNotify()'));
@@ -13692,6 +13718,12 @@
13718
x += '<div><label><input id=p20enotifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections" + '</label></div>';
13719
x += '<div><label><input id=p20enotifyIntelDeviceHelp type=checkbox />' + "Help requests" + '</label></div>';
13720
}
13721
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
13722
+ x += '<br /><div style="border-bottom: 1px solid #888;margin-bottom:3px">' + "Messaging Notifications" + '</div>';
13723
+ x += '<div><label><input id=p20emsgDeviceConnect type=checkbox />' + "Device connections" + '</label></div>';
13724
+ x += '<div><label><input id=p20emsgDeviceDisconnect type=checkbox />' + "Device disconnections" + '</label></div>';
13725
+ x += '<div><label><input id=p20emsgDeviceHelp type=checkbox />' + "Help requests" + '</label></div>';
13726
+ }
13727
setDialogMode(2, "Notification Settings", 3, p20editMeshNotifyEx, x, emailNotify);
13728
Q('p20notifyIntelDeviceConnect').checked = (meshNotify & 2);
13729
Q('p20notifyIntelDeviceDisconnect').checked = (meshNotify & 4);
@@ -13701,6 +13733,11 @@
13733
Q('p20enotifyIntelDeviceDisconnect').checked = (meshNotify & 32);
13734
Q('p20enotifyIntelDeviceHelp').checked = (meshNotify & 64);
13735
}
13736
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
13737
+ Q('p20emsgDeviceConnect').checked = (meshNotify & 128);
13738
+ Q('p20emsgDeviceDisconnect').checked = (meshNotify & 256);
13739
+ Q('p20emsgDeviceHelp').checked = (meshNotify & 512);
13740
+ }
13741
return false;
13742
}
13743
@@ -13714,6 +13751,11 @@
13751
meshNotify += Q('p20enotifyIntelDeviceDisconnect').checked ? 32 : 0;
13752
meshNotify += Q('p20enotifyIntelDeviceHelp').checked ? 64 : 0;
13753
}
13754
+ if ((userinfo.msghandle != null) && ((features2 & 0x02000000) != 0)) {
13755
+ meshNotify += Q('p20emsgDeviceConnect').checked ? 128 : 0;
13756
+ meshNotify += Q('p20emsgDeviceDisconnect').checked ? 256 : 0;
13757
+ meshNotify += Q('p20emsgDeviceHelp').checked ? 512 : 0;
13758
+ }
13759
meshserver.send({ action: 'changemeshnotify', meshid: currentMesh._id, notify: meshNotify });
13760
}
13761