Fix issue with promoting and demoting users in a team

This commit is contained in:
yflory 2019-09-26 11:32:04 +02:00
parent 5ad5e32ec8
commit 0d0eaebb1f

View File

@ -409,10 +409,10 @@ define([
}; };
var ROLES = ['MEMBER', 'ADMIN', 'OWNER']; var ROLES = ['MEMBER', 'ADMIN', 'OWNER'];
var describeUser = function (common, data, icon) { var describeUser = function (common, curvePublic, data, icon) {
APP.module.execCommand('DESCRIBE_USER', { APP.module.execCommand('DESCRIBE_USER', {
teamId: APP.team, teamId: APP.team,
curvePublic: data.curvePublic, curvePublic: curvePublic,
data: data data: data
}, function (obj) { }, function (obj) {
if (obj && obj.error) { if (obj && obj.error) {
@ -443,9 +443,10 @@ define([
title: Messages.team_rosterPromote title: Messages.team_rosterPromote
}); });
$(promote).click(function () { $(promote).click(function () {
data.role = 'ADMIN';
$(promote).hide(); $(promote).hide();
describeUser(common, data, promote); describeUser(common, data.curvePublic, {
role: 'ADMIN'
}, promote);
}); });
$actions.append(promote); $actions.append(promote);
} }
@ -456,9 +457,11 @@ define([
title: Messages.team_rosterDemote title: Messages.team_rosterDemote
}); });
$(demote).click(function () { $(demote).click(function () {
data.role = ROLES[theirRole - 1] || 'MEMBER'; var role = ROLES[theirRole - 1] || 'MEMBER';
$(demote).hide(); $(demote).hide();
describeUser(common, data, demote); describeUser(common, data.curvePublic, {
role: role
}, promote);
}); });
$actions.append(demote); $actions.append(demote);
} }