Write sessionID into the doc on new session creation
This commit is contained in:
parent
6336a30cb9
commit
37fa0c203f
|
@ -1032,6 +1032,8 @@ Zotero.Integration.Document.prototype._getSession = Zotero.Promise.coroutine(fun
|
|||
this._session = this._createNewSession(data);
|
||||
try {
|
||||
yield this._session.setData(data);
|
||||
// this._createNewSession() updates sessionID, which we need to store back into the doc
|
||||
this._doc.setDocumentData(me._session.data.serialize())
|
||||
} catch(e) {
|
||||
// make sure style is defined
|
||||
if(e instanceof Zotero.Exception.Alert && e.name === "integration.error.invalidStyle") {
|
||||
|
|
|
@ -352,10 +352,10 @@ describe("Zotero.Integration", function () {
|
|||
assert.isFalse(setDocumentDataSpy.called);
|
||||
});
|
||||
|
||||
it('should not call doc.setDocumentData when document communicates for first time since restart, but has data', function* () {
|
||||
it('should call doc.setDocumentData when document communicates for first time since restart to write new sessionID', function* () {
|
||||
Zotero.Integration.sessions = {};
|
||||
yield execCommand('addEditCitation', docID);
|
||||
assert.isFalse(setDocumentDataSpy.called);
|
||||
assert.isTrue(setDocumentDataSpy.calledOnce);
|
||||
});
|
||||
|
||||
describe('when style used in the document does not exist', function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user