From fa89ab410d2927c126174f1c0b3036ded4f3c0bc Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 17 Sep 2019 16:54:03 +0200 Subject: [PATCH] Revert previous commit and make the team pin everything --- www/common/outer/async-store.js | 15 --------------- www/common/outer/messenger.js | 2 +- www/common/outer/team.js | 26 ++++++++++---------------- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index af44b3d26..b766370c3 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -184,21 +184,6 @@ define([ 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.sort(); diff --git a/www/common/outer/messenger.js b/www/common/outer/messenger.js index 0f2a527b3..7534db130 100644 --- a/www/common/outer/messenger.js +++ b/www/common/outer/messenger.js @@ -771,7 +771,7 @@ define([ var chanId = chatData.channel; 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 () { ctx.emit('TEAMCHAT_READY', chanId, [clientId]); diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 993611ee3..11229a08c 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -76,14 +76,15 @@ define([ if (!store) { return null; } var list = store.manager.getChannelsList('pin'); - // Teams will always be owned for now - // XXX if the team is not owned, add the teamChannel to the list - /* - var _team = Util.find(ctx, ['store', 'proxy', 'teams', id]); - var secret = Hash.getSecrets('team', _team.hash, _team.password); - var teamChannel = secret.channel; - list.push(userChannel); - */ + var team = ctx.store.proxy.teams[id]; + 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 Add the team mailbox @@ -140,7 +141,7 @@ define([ }; 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 {}; } var secret = Hash.getSecrets('chat', hash); return { @@ -306,13 +307,6 @@ define([ owners: [ctx.store.proxy.edPublic] }; 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! var chatCfg = { network: ctx.store.network,