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:
parent
4bd211b42a
commit
923969b38c
2 changed files with 3 additions and 5 deletions
|
@ -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({
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue