Merge pull request #24895 from overleaf/em-fix-history-changes

Properly serialize changes returned by the history changes endpoint

GitOrigin-RevId: a85fd8aede9316100d2cec901c1ab9b7d1faa9bb
This commit is contained in:
Eric Mc Sween
2025-04-15 08:06:19 +00:00
committed by Copybot
parent d8c5160349
commit 397a546095
2 changed files with 3 additions and 9 deletions
@@ -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) {
@@ -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'])
})
})