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);
}
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();

@ -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]);

@ -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,

Loading…
Cancel
Save