Skip to content

Commit

Permalink
Merge pull request TryGhost#3437 from morficus/issue-3433
Browse files Browse the repository at this point in the history
Error when inviting users
  • Loading branch information
ErisDS committed Jul 29, 2014
2 parents e8bb8e2 + e15fb9e commit 9343bcc
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 226 deletions.
8 changes: 8 additions & 0 deletions core/server/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,14 @@ User = ghostBookshelf.Model.extend({
}).then(function (addedUser) {
// Assign the userData to our created user so we can pass it back
userData = addedUser;
//if we are given a "role" object, only pass in the role ID in place of the full object
roles = _.map(roles, function (role) {
if (_.isNumber(role)) {
return role;
} else {
return parseInt(role.id, 10);
}
});

return userData.roles().attach(roles);
}).then(function () {
Expand Down
Loading

0 comments on commit 9343bcc

Please sign in to comment.