From 1effe36d9651dc189b5e6c57953d2c0369e27d71 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 20 May 2014 09:51:16 +0200 Subject: [PATCH] Sync email notifications between owners of the room --- public/js/vroom.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/js/vroom.js b/public/js/vroom.js index 5a51822..41c02b2 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -94,6 +94,7 @@ function removeNotifiedEmail(email){ if (data.status == 'success'){ $.notify(data.msg, 'success'); $('#emailNotification_' + id).remove(); + webrtc.sendToAll('notif_change', {}); } else{ $.notify(data.msg, 'error'); @@ -744,6 +745,15 @@ function initVroom(room) { getPeerRole(data.id); }); + // A new notified email has been added + webrtc.on('notif_change', function(data){ + if (peers.local.role != 'owner'){ + return; + } + $('#emailNotificationList > li').remove(); + getRoomInfo(); + }); + // A few notif on password set/unset or lock/unlock webrtc.on('room_locked', function(data){ $('#lockLabel').addClass('btn-danger active'); @@ -1172,6 +1182,7 @@ function initVroom(room) { if (data.status == 'success'){ $.notify(data.msg, 'success'); addNotifiedEmail($('#newEmailNotification').val()); + webrtc.sendToAll('notif_change', {}); $('#newEmailNotification').val(''); } else{