mirror of https://github.com/xwiki-labs/cryptpad
Fix undefined notifications
This commit is contained in:
parent
6131e89505
commit
a2d52d7026
|
@ -501,8 +501,11 @@ proxy.mailboxes = {
|
||||||
hash: h
|
hash: h
|
||||||
};
|
};
|
||||||
showMessage(ctx, type, message, cId, function (obj) {
|
showMessage(ctx, type, message, cId, function (obj) {
|
||||||
|
if (obj.error) { return; }
|
||||||
|
// Notify only if "requiresNotif" is true
|
||||||
|
if (!message.msg || !message.msg.requiresNotif) { return; }
|
||||||
Notify.system(undefined, obj.msg);
|
Notify.system(undefined, obj.msg);
|
||||||
cb();
|
delete message.msg.requiresNotif;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -590,6 +593,9 @@ proxy.mailboxes = {
|
||||||
mailbox.showMessage = function (type, msg, cId, cb) {
|
mailbox.showMessage = function (type, msg, cId, cb) {
|
||||||
if (type === "reminders" && msg) {
|
if (type === "reminders" && msg) {
|
||||||
ctx.boxes.reminders.content[msg.hash] = msg.msg;
|
ctx.boxes.reminders.content[msg.hash] = msg.msg;
|
||||||
|
if (!ctx.clients.length) {
|
||||||
|
ctx.boxes.reminders.content[msg.hash].requiresNotif = true;
|
||||||
|
}
|
||||||
// Hide existing messages for this event
|
// Hide existing messages for this event
|
||||||
hideMessage(ctx, type, msg.hash, ctx.clients);
|
hideMessage(ctx, type, msg.hash, ctx.clients);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue