0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Removed user_id constraint when upserting session (#10085)

no-issue

This is to stop an issue when creating a session, if you already have an existing session
This commit is contained in:
Fabien O'Carroll 2018-10-30 16:15:48 +07:00 committed by GitHub
parent 4bd211b42a
commit 923969b38c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -53,7 +53,7 @@ const Session = ghostBookshelf.Model.extend({
const sessionId = options.session_id;
const sessionData = data.session_data;
const userId = sessionData.user_id;
return this.findOne({session_id: sessionId, user_id: userId}, options)
return this.findOne({session_id: sessionId}, options)
.then((model) => {
if (model) {
return this.edit({

View file

@ -175,8 +175,7 @@ describe('Unit: models/session', function () {
should.equal(filterOptionsStub.args[0][1], 'upsert');
should.deepEqual(findOneStub.args[0][0], {
session_id,
user_id: data.session_data.user_id
session_id
});
should.equal(findOneStub.args[0][1], filteredOptions);
@ -215,8 +214,7 @@ describe('Unit: models/session', function () {
should.equal(filterOptionsStub.args[0][1], 'upsert');
should.deepEqual(findOneStub.args[0][0], {
session_id,
user_id: data.session_data.user_id
session_id
});
should.equal(findOneStub.args[0][1], filteredOptions);