Просмотр исходного кода

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

GitOrigin-RevId: accd6d9dc0165ff2cc9f8edd28c42d38b76ba909
Jakob Ackermann 1 год назад
Родитель
Сommit
982f647845

+ 1 - 0
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)

+ 20 - 5
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