From 982f647845ab1148dadf473263a6996334c66d29 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 17 Jun 2025 13:47:33 +0200 Subject: [PATCH] [web] copy duplicated comment id into id field (#26481) GitOrigin-RevId: accd6d9dc0165ff2cc9f8edd28c42d38b76ba909 --- .../src/Features/History/RestoreManager.js | 1 + .../unit/src/History/RestoreManagerTests.js | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/services/web/app/src/Features/History/RestoreManager.js b/services/web/app/src/Features/History/RestoreManager.js index 0d3e96b97f..16ef2024f6 100644 --- a/services/web/app/src/Features/History/RestoreManager.js +++ b/services/web/app/src/Features/History/RestoreManager.js @@ -207,6 +207,7 @@ const RestoreManager = { continue } // We have a new id for this comment thread + comment.id = result.duplicateId comment.op.t = result.duplicateId } newRanges.comments.push(comment) diff --git a/services/web/test/unit/src/History/RestoreManagerTests.js b/services/web/test/unit/src/History/RestoreManagerTests.js index a22793de85..f76ba506ad 100644 --- a/services/web/test/unit/src/History/RestoreManagerTests.js +++ b/services/web/test/unit/src/History/RestoreManagerTests.js @@ -266,13 +266,28 @@ describe('RestoreManager', function () { beforeEach(function () { this.pathname = 'foo.tex' this.comments = [ - { op: { t: 'comment-in-other-doc', p: 0, c: 'foo' } }, - { op: { t: 'single-comment', p: 10, c: 'bar' } }, - { op: { t: 'deleted-comment', p: 20, c: 'baz' } }, + { + id: 'comment-in-other-doc', + op: { t: 'comment-in-other-doc', p: 0, c: 'foo' }, + }, + { + id: 'single-comment', + op: { t: 'single-comment', p: 10, c: 'bar' }, + }, + { + id: 'deleted-comment', + op: { t: 'deleted-comment', p: 20, c: 'baz' }, + }, ] this.remappedComments = [ - { op: { t: 'duplicate-comment', p: 0, c: 'foo' } }, - { op: { t: 'single-comment', p: 10, c: 'bar' } }, + { + id: 'duplicate-comment', + op: { t: 'duplicate-comment', p: 0, c: 'foo' }, + }, + { + id: 'single-comment', + op: { t: 'single-comment', p: 10, c: 'bar' }, + }, ] this.ProjectLocator.promises.findElementByPath = sinon.stub().rejects() this.DocstoreManager.promises.getCommentThreadIds = sinon