[web] copy duplicated comment id into id field (#26481)

GitOrigin-RevId: accd6d9dc0165ff2cc9f8edd28c42d38b76ba909
This commit is contained in:
Jakob Ackermann
2025-06-18 08:05:39 +00:00
committed by Copybot
parent 39b4aed85f
commit 982f647845
2 changed files with 21 additions and 5 deletions
@@ -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)
@@ -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