Parcourir la source

Preserve resolve state in history on file restore (#26302)

* Preserve resolve state in history when doing a restore

* added comment why is resovled property deleted

GitOrigin-RevId: fb1011cf98a658b302c6eef1da83fb1006bb2052
Domagoj Kriskovic il y a 1 an
Parent
commit
fd1926a1c8

+ 3 - 0
services/docstore/app/js/RangeManager.js

@@ -53,6 +53,9 @@ module.exports = RangeManager = {
       if ((comment.op != null ? comment.op.t : undefined) != null) {
       if ((comment.op != null ? comment.op.t : undefined) != null) {
         comment.op.t = RangeManager._safeObjectId(comment.op.t)
         comment.op.t = RangeManager._safeObjectId(comment.op.t)
       }
       }
+      // resolved property is added to comments when they are obtained from history, but this state doesn't belong in mongo docs collection
+      // more info: https://github.com/overleaf/internal/issues/24371#issuecomment-2913095174
+      delete comment.op?.resolved
       updateMetadata(comment.metadata)
       updateMetadata(comment.metadata)
     }
     }
     return ranges
     return ranges

+ 0 - 2
services/web/app/src/Features/History/RestoreManager.js

@@ -231,8 +231,6 @@ const RestoreManager = {
         delete threadData.resolved_by_user_id
         delete threadData.resolved_by_user_id
         delete threadData.resolved_at
         delete threadData.resolved_at
       }
       }
-      // remove the resolved property from the comment range as the chat service is synced at this point
-      delete commentRange.op.resolved
     }
     }
 
 
     await ChatManager.promises.injectUserInfoIntoThreads(newCommentThreadData)
     await ChatManager.promises.injectUserInfoIntoThreads(newCommentThreadData)