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

Loading…
Cancel
Save