Revert previous commit and make the team pin everything

pull/1/head
yflory 5 years ago
parent 02cd15882b
commit fa89ab410d

@ -184,21 +184,6 @@ define([
list = list.concat(mList); list = list.concat(mList);
} }
if (store.proxy.teams) {
Object.keys(store.proxy.teams).forEach(function (id) {
var team = store.proxy.teams[id];
if (!team.owner) { return; }
list.push(team.channel);
var chatChannel = Util.find(team, ['keys', 'chat', 'channel']);
var membersChannel = Util.find(team, ['keys', 'members', 'channel']);
var mailboxChannel = Util.find(team, ['keys', 'mailbox', 'channel']);
if (chatChannel) { list.push(chatChannel); }
if (membersChannel) { list.push(membersChannel); }
if (mailboxChannel) { list.push(mailboxChannel); }
// XXX team mailbox
});
}
list.push(userChannel); list.push(userChannel);
list.sort(); list.sort();

@ -771,7 +771,7 @@ define([
var chanId = chatData.channel; var chanId = chatData.channel;
var secret = chatData.secret; var secret = chatData.secret;
if (!chanId || !secret) { return void cb({error: 'EINVAL'}); } if (!chanId || !secret) { return void _cb({error: 'EINVAL'}); }
var cb = Util.once(Util.mkAsync(function () { var cb = Util.once(Util.mkAsync(function () {
ctx.emit('TEAMCHAT_READY', chanId, [clientId]); ctx.emit('TEAMCHAT_READY', chanId, [clientId]);

@ -76,14 +76,15 @@ define([
if (!store) { return null; } if (!store) { return null; }
var list = store.manager.getChannelsList('pin'); var list = store.manager.getChannelsList('pin');
// Teams will always be owned for now var team = ctx.store.proxy.teams[id];
// XXX if the team is not owned, add the teamChannel to the list list.push(team.channel);
/* var chatChannel = Util.find(team, ['keys', 'chat', 'channel']);
var _team = Util.find(ctx, ['store', 'proxy', 'teams', id]); var membersChannel = Util.find(team, ['keys', 'members', 'channel']);
var secret = Hash.getSecrets('team', _team.hash, _team.password); var mailboxChannel = Util.find(team, ['keys', 'mailbox', 'channel']);
var teamChannel = secret.channel; if (chatChannel) { list.push(chatChannel); }
list.push(userChannel); if (membersChannel) { list.push(membersChannel); }
*/ if (mailboxChannel) { list.push(mailboxChannel); }
// XXX Add the team mailbox // XXX Add the team mailbox
@ -140,7 +141,7 @@ define([
}; };
team.getChatData = function () { team.getChatData = function () {
var hash = Util.find(ctx.store.proxy, ['teams', id, 'keys' 'chat', 'hash']); var hash = Util.find(ctx.store.proxy, ['teams', id, 'keys', 'chat', 'hash']);
if (!hash) { return {}; } if (!hash) { return {}; }
var secret = Hash.getSecrets('chat', hash); var secret = Hash.getSecrets('chat', hash);
return { return {
@ -306,13 +307,6 @@ define([
owners: [ctx.store.proxy.edPublic] owners: [ctx.store.proxy.edPublic]
}; };
nThen(function (waitFor) { nThen(function (waitFor) {
// XXX add this to the reset list too
ctx.pinPads([secret.channel, membersSecret.channel, chatSecret.channel], waitFor(function (obj) {
if (obj && obj.error) {
waitFor.abort();
return void cb(obj);
}
}));
// XXX initialize the members channel with yourself, and mark it as owned! // XXX initialize the members channel with yourself, and mark it as owned!
var chatCfg = { var chatCfg = {
network: ctx.store.network, network: ctx.store.network,

Loading…
Cancel
Save