Fix duplicate team script to support owners

pull/1/head
yflory 4 years ago
parent 9f389c5557
commit 79378c536e

@ -1676,22 +1676,22 @@ define([
// Not found yet? add to the list
if (!_t) {
_teams[t.channel] = { edit: Boolean(t.hash), id:id };
_teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id };
return;
}
// Team already found. If this one has better access rights, keep it.
// Otherwise, delete it
// No edit right or we already have edit rights? delete
if (!t.hash || _t.edit) {
// No edit right or we already had edit rights? delete
if (!t.hash || (!t.owner && _t.edit) || _t.owner) {
delete teams[id];
return;
}
// We didn't have edit rights and now we have them: replace
delete teams[_t.id];
_teams[t.channel] = { edit: Boolean(t.hash), id:id };
_teams[t.channel] = { edit: Boolean(t.hash), owner: t.owner, id:id };
});
// Load teams

Loading…
Cancel
Save