From 590e6bd21152529fb19f24e8b527c16d3d46c5f7 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 1 Oct 2019 11:57:21 +0200 Subject: [PATCH] Demote yourself --- www/common/translations/messages.json | 3 ++- www/teams/inner.js | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 20525bc13..175a14d65 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -1212,5 +1212,6 @@ "team_deleteTitle": "Team deletion", "team_deleteHint": "Delete the team and all documents owned exclusively by the team.", "team_deleteButton": "Delete", - "team_deleteConfirm": "You are about to delete all of an entire team's data. This may impact other team members access to their data. This cannot be undone. Are you sure you want to proceed?" + "team_deleteConfirm": "You are about to delete all of an entire team's data. This may impact other team members access to their data. This cannot be undone. Are you sure you want to proceed?", + "team_demoteMeConfirm": "You are about to give up your rights. You will not be able to undo this action. Are you sure?" } diff --git a/www/teams/inner.js b/www/teams/inner.js index b1cbc6e6f..97af2c131 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -452,7 +452,9 @@ define([ // Name var name = h('span.cp-team-member-name', data.displayName); if (data.pendingOwner) { - $(name).append(h('em', " PENDING")); // XXX + $(name).append(h('em', { + title: Messages.team_pendingOwnerTitle + }, ' ' + Messages.team_pendingOwner)); // + XXX ability to demote yourself as owner if there is another owner } // Status @@ -501,16 +503,25 @@ define([ } // If I'm not a member and I have an equal or higher role than them, I can demote them // (if they're not already a MEMBER) - if (!isMe && myRole >= theirRole && theirRole > 0 && !data.pending) { + if (myRole >= theirRole && theirRole > 0 && !data.pending) { var demote = h('span.fa.fa-angle-double-down', { title: Messages.team_rosterDemote }); $(demote).click(function () { - var role = ROLES[theirRole - 1] || 'MEMBER'; - $(demote).hide(); - describeUser(common, data.curvePublic, { - role: role - }, promote); + var todo = function () { + var role = ROLES[theirRole - 1] || 'MEMBER'; + $(demote).hide(); + describeUser(common, data.curvePublic, { + role: role + }, promote); + }; + if (isMe) { + return void UI.confirm(Messages.team_demoteMeConfirm, function (yes) { + if (!yes) { return; } + todo(); + }); + } + todo(); }); $actions.append(demote); }