Fix team deletion

pull/1/head
yflory 5 years ago
parent 75b3c99d04
commit 3015d7f22b

@ -1343,7 +1343,6 @@ define([
}];
var content = h('div', [
h('h4', 'Invite friends to your team: '+ team.name),
list.div
]);
@ -4020,8 +4019,15 @@ define([
module.execCommand('JOIN_TEAM', {
team: msg.content.team
}, function (obj) {
if (obj && obj.error) { return void UI.warn(Messages.error); }
if (obj && obj.error) {
if (obj.error === 'ENOENT') {
common.mailbox.dismiss(data, function () {});
return void UI.alert(Messages.deletedError);
}
return void UI.warn(Messages.error);
}
answer(true);
if (priv.app !== 'teams') { common.openURL('/teams/'); }
});
return;
}

@ -678,7 +678,7 @@ define([
give();
return void _w.abort();
}
otherOwners = md.owners.some(function (ed) { return void ed !== edPublic; });
otherOwners = md.owners.some(function (ed) { return ed !== edPublic; });
}));
}).nThen(function (_w) {
if (otherOwners) {

@ -568,6 +568,7 @@ define([
if (!me || me.role !== "OWNER") { return cb({ error: "EFORBIDDEN"}); }
var edPublic = Util.find(ctx, ['store', 'proxy', 'edPublic']);
var teamEdPublic = Util.find(teamData, ['keys', 'drive', 'edPublic']);
nThen(function (waitFor) {
ctx.Store.anonRpcMsg(null, {
@ -603,18 +604,24 @@ define([
msg: 'GET_METADATA',
data: c
}, _w(function (obj) {
if (obj && obj.error) { return void _w.abort(); }
if (obj && obj.error) {
give();
return void _w.abort();
}
var md = obj[0];
var isOwner = md && Array.isArray(md.owners) && md.owners.indexOf(edPublic) !== -1;
if (!isOwner) { return void _w.abort(); }
otherOwners = md.owners.some(function (ed) { return void ed !== edPublic; });
var isOwner = md && Array.isArray(md.owners) && md.owners.indexOf(teamEdPublic) !== -1;
if (!isOwner) {
give();
return void _w.abort();
}
otherOwners = md.owners.some(function (ed) { return ed !== teamEdPublic; });
}));
}).nThen(function (_w) {
if (otherOwners) {
ctx.Store.setPadMetadata(null, {
channel: c,
command: 'RM_OWNERS',
value: [edPublic],
value: [teamEdPublic],
}, _w());
return;
}

Loading…
Cancel
Save