Fix notification when we get promoted to owner

As getPeerRole is async now
This commit is contained in:
Daniel Berteaud 2015-06-26 16:27:28 +02:00
parent 92de57efdb
commit 43dc149050
1 changed files with 3 additions and 3 deletions

View File

@ -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');