From 43dc149050326e63bc4e0d1e0050c76fd40091d4 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 26 Jun 2015 16:27:28 +0200 Subject: [PATCH] Fix notification when we get promoted to owner As getPeerRole is async now --- public/js/vroom.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 92795e1..223de7c 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -1431,15 +1431,15 @@ function initVroom(room) { // An owner has just promoted a participant of the room to the owner role webrtc.on('owner_promoted', function(data){ + // Ignore if the emitter is not an owner, or is a screen if (peers[data.id].role != 'owner' || data.roomType == 'screen'){ return; } + // Are we the one being promoted ? if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){ var who = (peers[data.id].hasName) ? peers[data.id].displayName : localize('A_ROOM_ADMIN'); getPeerRole(peers.local.id); - if (peers.local.role == 'owner'){ - $.notify(sprintf(localize('s_IS_PROMOTING_YOU'), who), 'success'); - } + $.notify(sprintf(localize('s_IS_PROMOTING_YOU'), who), 'success'); } else if (data.payload.peer != peers.local.id && peers[data.payload.peer]){ var who = (peers[data.id].hasName) ? peers[data.id].displayName : localize('A_ROOM_ADMIN');