From 397a5460957879e1960e4deb052960229b9fcdd6 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Mon, 14 Apr 2025 15:29:47 -0400 Subject: [PATCH] Merge pull request #24895 from overleaf/em-fix-history-changes Properly serialize changes returned by the history changes endpoint GitOrigin-RevId: a85fd8aede9316100d2cec901c1ab9b7d1faa9bb --- services/history-v1/api/controllers/projects.js | 2 +- .../history-v1/test/acceptance/js/api/projects.test.js | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/services/history-v1/api/controllers/projects.js b/services/history-v1/api/controllers/projects.js index 15ed076e30..d42e29ab81 100644 --- a/services/history-v1/api/controllers/projects.js +++ b/services/history-v1/api/controllers/projects.js @@ -174,7 +174,7 @@ async function getChanges(req, res, next) { .slice(since - chunk.getStartVersion()) changes.unshift(...changesInChunk) - res.json(changes) + res.json(changes.map(change => change.toRaw())) } async function getZip(req, res, next) { diff --git a/services/history-v1/test/acceptance/js/api/projects.test.js b/services/history-v1/test/acceptance/js/api/projects.test.js index 7470a98c4f..3c333d8698 100644 --- a/services/history-v1/test/acceptance/js/api/projects.test.js +++ b/services/history-v1/test/acceptance/js/api/projects.test.js @@ -244,10 +244,7 @@ describe('project controller', function () { expect(response.status).to.equal(HTTPStatus.OK) const changes = response.obj expect(changes.length).to.equal(21) - expect(changes[10].operations[0].operation.textOperation).to.deep.equal([ - 9, - 'x', - ]) + expect(changes[10].operations[0].textOperation).to.deep.equal([9, 'x']) }) it('returns only requested changes', async function () { @@ -260,10 +257,7 @@ describe('project controller', function () { expect(response.status).to.equal(HTTPStatus.OK) const changes = response.obj expect(changes.length).to.equal(11) - expect(changes[2].operations[0].operation.textOperation).to.deep.equal([ - 11, - 'x', - ]) + expect(changes[2].operations[0].textOperation).to.deep.equal([11, 'x']) }) })