|
|
@ -70,6 +70,18 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var closeTeam = function (ctx, teamId) {
|
|
|
|
|
|
|
|
var team = ctx.teams[teamId];
|
|
|
|
|
|
|
|
if (!team) { return; }
|
|
|
|
|
|
|
|
team.listmap.stop();
|
|
|
|
|
|
|
|
team.roster.stop();
|
|
|
|
|
|
|
|
team.proxy = {};
|
|
|
|
|
|
|
|
delete ctx.teams[teamId];
|
|
|
|
|
|
|
|
delete ctx.store.proxy.teams[teamId];
|
|
|
|
|
|
|
|
ctx.emit('LEAVE_TEAM', teamId, team.clients);
|
|
|
|
|
|
|
|
ctx.updateMetadata();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getTeamChannelList = function (ctx, id) {
|
|
|
|
var getTeamChannelList = function (ctx, id) {
|
|
|
|
// Get the list of pads' channel ID in your drive
|
|
|
|
// Get the list of pads' channel ID in your drive
|
|
|
|
// This list is filtered so that it doesn't include pad owned by other users
|
|
|
|
// This list is filtered so that it doesn't include pad owned by other users
|
|
|
@ -141,14 +153,7 @@ define([
|
|
|
|
var state = roster.getState();
|
|
|
|
var state = roster.getState();
|
|
|
|
var me = Util.find(ctx, ['store', 'proxy', 'curvePublic']);
|
|
|
|
var me = Util.find(ctx, ['store', 'proxy', 'curvePublic']);
|
|
|
|
if (!state.members[me]) {
|
|
|
|
if (!state.members[me]) {
|
|
|
|
lm.stop();
|
|
|
|
return void closeTeam(ctx, id);
|
|
|
|
roster.stop();
|
|
|
|
|
|
|
|
proxy = {};
|
|
|
|
|
|
|
|
delete ctx.teams[id];
|
|
|
|
|
|
|
|
delete ctx.store.proxy.teams[id];
|
|
|
|
|
|
|
|
ctx.emit('LEAVE_TEAM', id, team.clients);
|
|
|
|
|
|
|
|
ctx.updateMetadata();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var teamData = Util.find(ctx, ['store', 'proxy', 'teams', id]);
|
|
|
|
var teamData = Util.find(ctx, ['store', 'proxy', 'teams', id]);
|
|
|
|
if (teamData) { teamData.metadata = state.metadata; }
|
|
|
|
if (teamData) { teamData.metadata = state.metadata; }
|
|
|
@ -514,13 +519,7 @@ define([
|
|
|
|
var curvePublic = ctx.store.proxy.curvePublic;
|
|
|
|
var curvePublic = ctx.store.proxy.curvePublic;
|
|
|
|
team.roster.remove([curvePublic], function (err) {
|
|
|
|
team.roster.remove([curvePublic], function (err) {
|
|
|
|
if (err) { return void cb({error: err}); }
|
|
|
|
if (err) { return void cb({error: err}); }
|
|
|
|
team.lm.stop();
|
|
|
|
closeTeam(ctx, teamId);
|
|
|
|
team.roster.stop();
|
|
|
|
|
|
|
|
team.proxy = {};
|
|
|
|
|
|
|
|
delete ctx.teams[teamId];
|
|
|
|
|
|
|
|
delete ctx.store.proxy.teams[teamId];
|
|
|
|
|
|
|
|
ctx.emit('LEAVE_TEAM', teamId, team.clients);
|
|
|
|
|
|
|
|
ctx.updateMetadata();
|
|
|
|
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|