diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 76dec3dd8..2e6c3a609 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -736,14 +736,20 @@ define([ UI.proposal = function (content, cb) { + var clicked = false; var buttons = [{ name: Messages.friendRequest_later, - onClick: function () {}, + onClick: function () { + if (clicked) { return; } + clicked = true; + }, keys: [27] }, { className: 'primary', name: Messages.friendRequest_accept, onClick: function () { + if (clicked) { return; } + clicked = true; cb(true); }, keys: [13] @@ -751,6 +757,8 @@ define([ className: 'primary', name: Messages.friendRequest_decline, onClick: function () { + if (clicked) { return; } + clicked = true; cb(false); }, keys: [[13, 'ctrl']] diff --git a/www/common/outer/team.js b/www/common/outer/team.js index 2ba4e30ee..4ecfc09b6 100644 --- a/www/common/outer/team.js +++ b/www/common/outer/team.js @@ -1668,7 +1668,33 @@ define([ updateMyRights(ctx, p[1]); }); + // Remove duplicate teams + var _teams = {}; + Object.keys(teams).forEach(function (id) { + var t = teams[id]; + var _t = _teams[t.channel]; + + // Not found yet? add to the list + if (!_t) { + _teams[t.channel] = { edit: Boolean(t.hash), 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) { + 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 }; + }); + // Load teams Object.keys(teams).forEach(function (id) { ctx.onReadyHandlers[id] = []; if (!Util.find(teams, [id, 'keys', 'mailbox'])) {