зеркало из https://github.com/mozilla/galaxy-api.git
change companySlug to teamSlug, add team slug modification function. fix issue #141
This commit is contained in:
Родитель
b1b5883d3d
Коммит
a81c6de5de
14
lib/user.js
14
lib/user.js
|
@ -47,7 +47,7 @@ function updateUser(client, userID, opts, callback) {
|
|||
var newUserData = _.clone(userData);
|
||||
|
||||
var updateFunctions = {
|
||||
companySlug: updateCompanySlug,
|
||||
teamSlug: updateTeamSlug,
|
||||
email: updateEmail,
|
||||
username: updateUsername
|
||||
};
|
||||
|
@ -72,13 +72,13 @@ function updateUser(client, userID, opts, callback) {
|
|||
resolve(newUserData);
|
||||
});
|
||||
}
|
||||
function updateCompanySlug(newSlug) {
|
||||
function updateTeamSlug(newSlug) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (userData.companySlug !== newSlug) {
|
||||
newUserData.companySlug = newSlug;
|
||||
// remove id from old companySlug and add to new one
|
||||
client.lrem(userData.companySlug, 1, userData.id);
|
||||
client.rpush(newUserData.companySlug, newUserData.id);
|
||||
if (userData.teamSlug !== newSlug) {
|
||||
newUserData.teamSlug = newSlug;
|
||||
// remove id from old teamSlug and add to new one
|
||||
client.lrem(userData.teamSlug, 1, userData.id);
|
||||
client.rpush(newUserData.teamSlug, newUserData.id);
|
||||
}
|
||||
resolve(newUserData);
|
||||
});
|
||||
|
|
|
@ -37,6 +37,10 @@ module.exports = function(server) {
|
|||
description: 'New team name',
|
||||
isRequired: false
|
||||
},
|
||||
teamSlug: {
|
||||
description: 'New team slug',
|
||||
isRequired: false
|
||||
},
|
||||
homepage: {
|
||||
description: 'New team URL',
|
||||
isRequired: false
|
||||
|
@ -48,6 +52,7 @@ module.exports = function(server) {
|
|||
username: DATA.username,
|
||||
email: DATA.email,
|
||||
teamName: DATA.teamName,
|
||||
teamSlug: DATA.teamSlug,
|
||||
homepage: DATA.homepage
|
||||
};
|
||||
user.updateUser(client, id, dataToUpdate, function(err, newUserData) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче