prevent self showing up on realtime problem

This commit is contained in:
Connor Turland 2014-09-15 22:04:44 -04:00
parent b6893d8f92
commit f62ca67d9f

View file

@ -1591,16 +1591,18 @@ Metamaps.Realtime = {
mapperListItem += '<div class="littleJuntoIcon"></div>'; mapperListItem += '<div class="littleJuntoIcon"></div>';
mapperListItem += '</li>'; mapperListItem += '</li>';
$('#mapper' + data.userid).remove(); if (data.userid !== Metamaps.Active.Mapper.id) {
$('.realtimeMapperList ul').append(mapperListItem); $('#mapper' + data.userid).remove();
$('.realtimeMapperList ul').append(mapperListItem);
// create a div for the collaborators compass // create a div for the collaborators compass
$('#compass' + data.userid).remove(); $('#compass' + data.userid).remove();
$('<div/>', { $('<div/>', {
id: 'compass' + data.userid, id: 'compass' + data.userid,
text: data.username, text: data.username,
class: 'collabCompass' class: 'collabCompass'
}).appendTo('#wrapper'); }).appendTo('#wrapper');
}
}, },
newPeerOnMap: function (data) { newPeerOnMap: function (data) {
var self = Metamaps.Realtime; var self = Metamaps.Realtime;
@ -1617,34 +1619,36 @@ Metamaps.Realtime = {
}; };
// create an item for them in the realtime box // create an item for them in the realtime box
var mapperListItem = '<li id="mapper' + data.userid + '" class="rtMapper littleRtOn">'; if (data.userid !== Metamaps.Active.Mapper.id) {
mapperListItem += '<img src="' + data.userimage + '" width="24" height="24" class="rtUserImage" />'; var mapperListItem = '<li id="mapper' + data.userid + '" class="rtMapper littleRtOn">';
mapperListItem += data.username; mapperListItem += '<img src="' + data.userimage + '" width="24" height="24" class="rtUserImage" />';
mapperListItem += '<div class="littleJuntoIcon"></div>'; mapperListItem += data.username;
mapperListItem += '</li>'; mapperListItem += '<div class="littleJuntoIcon"></div>';
$('#mapper' + data.userid).remove(); mapperListItem += '</li>';
$('.realtimeMapperList ul').append(mapperListItem); $('#mapper' + data.userid).remove();
$('.realtimeMapperList ul').append(mapperListItem);
// create a div for the collaborators compass // create a div for the collaborators compass
$('#compass' + data.userid).remove(); $('#compass' + data.userid).remove();
$('<div/>', { $('<div/>', {
id: 'compass' + data.userid, id: 'compass' + data.userid,
text: data.username, text: data.username,
class: 'collabCompass' class: 'collabCompass'
}).appendTo('#wrapper'); }).appendTo('#wrapper');
Metamaps.GlobalUI.notifyUser(data.username + ' just joined the map'); Metamaps.GlobalUI.notifyUser(data.username + ' just joined the map');
// send this new mapper back your details, and the awareness that you've loaded the map // send this new mapper back your details, and the awareness that you've loaded the map
var update = { var update = {
userToNotify: data.userid, userToNotify: data.userid,
username: Metamaps.Active.Mapper.get("name"), username: Metamaps.Active.Mapper.get("name"),
userimage: Metamaps.Active.Mapper.get("image"), userimage: Metamaps.Active.Mapper.get("image"),
userid: Metamaps.Active.Mapper.id, userid: Metamaps.Active.Mapper.id,
userrealtime: self.status, userrealtime: self.status,
mapid: Metamaps.Active.Map.id mapid: Metamaps.Active.Map.id
}; };
socket.emit('updateNewMapperList', update); socket.emit('updateNewMapperList', update);
}
}, },
lostPeerOnMap: function (data) { lostPeerOnMap: function (data) {
var self = Metamaps.Realtime; var self = Metamaps.Realtime;