mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge pull request #4808 from jaswilli/invite-error
Check all users when generating slug
This commit is contained in:
commit
8d43a7484a
2 changed files with 22 additions and 1 deletions
|
@ -61,7 +61,7 @@ User = ghostBookshelf.Model.extend({
|
||||||
if (this.hasChanged('slug') || !this.get('slug')) {
|
if (this.hasChanged('slug') || !this.get('slug')) {
|
||||||
// Generating a slug requires a db call to look for conflicting slugs
|
// Generating a slug requires a db call to look for conflicting slugs
|
||||||
return ghostBookshelf.Model.generateSlug(User, this.get('slug') || this.get('name'),
|
return ghostBookshelf.Model.generateSlug(User, this.get('slug') || this.get('name'),
|
||||||
{transacting: options.transacting, shortSlug: !this.get('slug')})
|
{status: 'all', transacting: options.transacting, shortSlug: !this.get('slug')})
|
||||||
.then(function (slug) {
|
.then(function (slug) {
|
||||||
self.set({slug: slug});
|
self.set({slug: slug});
|
||||||
});
|
});
|
||||||
|
|
|
@ -492,6 +492,27 @@ describe('Users API', function () {
|
||||||
done();
|
done();
|
||||||
}).catch(done);
|
}).catch(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Can add two users with the same local-part in their email addresses', function (done) {
|
||||||
|
newUser.roles = [roleIdFor.author];
|
||||||
|
|
||||||
|
UserAPI.add({users: [newUser]}, _.extend({}, context.owner, {include: 'roles'}))
|
||||||
|
.then(function (response) {
|
||||||
|
checkAddResponse(response);
|
||||||
|
response.users[0].id.should.eql(8);
|
||||||
|
response.users[0].roles[0].name.should.equal('Author');
|
||||||
|
}).then(function () {
|
||||||
|
newUser.email = newUser.email.split('@')[0] + '@someotherdomain.com';
|
||||||
|
return UserAPI.add({users: [newUser]}, _.extend({}, context.owner, {include: 'roles'}))
|
||||||
|
.then(function (response) {
|
||||||
|
checkAddResponse(response);
|
||||||
|
response.users[0].id.should.eql(9);
|
||||||
|
response.users[0].roles[0].name.should.equal('Author');
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}).catch(done);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Editor', function () {
|
describe('Editor', function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue