Add a limit of teams

pull/1/head
yflory 5 years ago
parent b16dd2907b
commit 007c73d36b

@ -748,6 +748,7 @@ define([
var t = {}; var t = {};
Object.keys(teams).forEach(function (id) { Object.keys(teams).forEach(function (id) {
t[id] = { t[id] = {
owner: teams[id].owner,
name: teams[id].metadata.name, name: teams[id].metadata.name,
edPublic: Util.find(teams[id], ['keys', 'drive', 'edPublic']), edPublic: Util.find(teams[id], ['keys', 'drive', 'edPublic']),
avatar: Util.find(teams[id], ['metadata', 'avatar']) avatar: Util.find(teams[id], ['metadata', 'avatar'])

@ -303,7 +303,20 @@ define([
}); });
makeBlock('create', function (common, cb) { makeBlock('create', function (common, cb) {
var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
var content = []; var content = [];
var isOwner = Object.keys(privateData.teams || {}).some(function (id) {
return privateData.teams[id].owner;
});
if (Object.keys(privateData.teams || {}).length >= 3 || isOwner) {
content.push(h('div.alert.alert-warning', {
role:'alert'
}, isOwner ? Messages.team_maxOwner : Messages.team_maxTeams));
return void cb(content);
}
content.push(h('h3', Messages.team_createLabel)); content.push(h('h3', Messages.team_createLabel));
content.push(h('label', Messages.team_createName)); content.push(h('label', Messages.team_createName));
var input = h('input', {type:'text'}); var input = h('input', {type:'text'});

Loading…
Cancel
Save