From 3c19a340a212177ac88d434f6452d5939ff5eeda Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 30 May 2014 12:36:38 +0200 Subject: [PATCH] Don't display peer ID if the peer has no displayName --- public/js/vroom.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index 87edb0b..f413c0f 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -925,13 +925,14 @@ function initVroom(room) { if (data.roomType == 'screen' || peers[data.id].role != 'owner'){ return; } + var who = (peers[data.id].hasName) ? peers[data.id].displayName : locale.A_ROOM_ADMIN; if (data.payload.action == 'set'){ - $.notify(sprintf(locale.PASSWORD_PROTECT_ON_BY_s, stringEscape(peers[data.id].displayName)), 'info'); + $.notify(sprintf(locale.PASSWORD_PROTECT_ON_BY_s, stringEscape(who)), 'info'); $('#joinPassLabel').addClass('btn-danger active'); $('#joinPassButton').prop('checked', true); } else{ - $.notify(sprintf(locale.PASSWORD_PROTECT_OFF_BY_s, stringEscape(peers[data.id].displayName)), 'info'); + $.notify(sprintf(locale.PASSWORD_PROTECT_OFF_BY_s, stringEscape(who)), 'info'); $('#joinPassLabel').removeClass('btn-danger active'); $('#joinPassButton').prop('checked', false); } @@ -941,13 +942,14 @@ function initVroom(room) { return; } if (peers.local.role == 'owner'){ + var who = (peers[data.id].hasName) ? peers[data.id].displayName : locale.A_ROOM_ADMIN; if (data.payload.action == 'set'){ - $.notify(sprintf(locale.OWNER_PASSWORD_CHANGED_BY_s, stringEscape(peers[data.id].displayName)), 'warn'); + $.notify(sprintf(locale.OWNER_PASSWORD_CHANGED_BY_s, stringEscape(who)), 'warn'); $('#persistentLabel').addClass('btn-danger active'); $('#persistentButton').prop('checked', true); } else{ - $.notify(sprintf(locale.OWNER_PASSWORD_REMOVED_BY_s, stringEscape(peers[data.id].displayName)), 'warn'); + $.notify(sprintf(locale.OWNER_PASSWORD_REMOVED_BY_s, stringEscape(who)), 'warn'); $('#persistentLabel').removeClass('btn-danger active'); $('#persistentButton').prop('checked', false); }