From ad006205ecded06b4d7d57aae051cf2c9339790e Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 29 Jun 2023 12:47:20 +0200 Subject: [PATCH] Merge pull request #13575 from overleaf/msm-ce-sp-hotfix-3-5-8--4-0-3 CE/SP hotfixes 3.5.8 and 4.0.3 GitOrigin-RevId: c9ed39553154065d5eb59dfa0096756a2b1b1211 --- server-ce/hotfix/3.5.8/Dockerfile | 5 +++++ server-ce/hotfix/3.5.8/pr_13574.patch | 22 ++++++++++++++++++++++ server-ce/hotfix/4.0.3/Dockerfile | 7 +++++++ server-ce/hotfix/4.0.3/pr_13574.patch | 22 ++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 server-ce/hotfix/3.5.8/Dockerfile create mode 100644 server-ce/hotfix/3.5.8/pr_13574.patch create mode 100644 server-ce/hotfix/4.0.3/Dockerfile create mode 100644 server-ce/hotfix/4.0.3/pr_13574.patch diff --git a/server-ce/hotfix/3.5.8/Dockerfile b/server-ce/hotfix/3.5.8/Dockerfile new file mode 100644 index 0000000000..ea7b7f780f --- /dev/null +++ b/server-ce/hotfix/3.5.8/Dockerfile @@ -0,0 +1,5 @@ +FROM sharelatex/sharelatex:3.5.7 + +# Patch: fixes anonymous edits breaking history +COPY pr_13574.patch . +RUN patch -p0 < pr_13574.patch diff --git a/server-ce/hotfix/3.5.8/pr_13574.patch b/server-ce/hotfix/3.5.8/pr_13574.patch new file mode 100644 index 0000000000..6d507151a6 --- /dev/null +++ b/server-ce/hotfix/3.5.8/pr_13574.patch @@ -0,0 +1,22 @@ +--- services/project-history/app/js/UpdateTranslator.js ++++ services/project-history/app/js/UpdateTranslator.js +@@ -73,9 +73,18 @@ function _convertToChange(projectId, updateWithBlob) { + throw error + } + ++ let v2Authors ++ if (update.meta.user_id === 'anonymous-user') { ++ // history-v1 uses null to represent an anonymous author ++ v2Authors = [null] ++ } else { ++ // user_id is missing on resync operations that update the contents of a doc ++ v2Authors = _.compact([update.meta.user_id]) ++ } ++ + const rawChange = { + operations, +- v2Authors: _.compact([update.meta.user_id]), ++ v2Authors, + timestamp: new Date(update.meta.ts).toISOString(), + projectVersion, + v2DocVersions: Object.keys(v2DocVersions).length ? v2DocVersions : null, diff --git a/server-ce/hotfix/4.0.3/Dockerfile b/server-ce/hotfix/4.0.3/Dockerfile new file mode 100644 index 0000000000..02199b75c3 --- /dev/null +++ b/server-ce/hotfix/4.0.3/Dockerfile @@ -0,0 +1,7 @@ +# 4.0.1 was tagged as 4.0.2 in dockerhub to keep parity with Server Pro +FROM sharelatex/sharelatex:4.0.1 + + +# Patch: fixes anonymous edits breaking history +COPY pr_13574.patch . +RUN patch -p0 < pr_13574.patch diff --git a/server-ce/hotfix/4.0.3/pr_13574.patch b/server-ce/hotfix/4.0.3/pr_13574.patch new file mode 100644 index 0000000000..6d507151a6 --- /dev/null +++ b/server-ce/hotfix/4.0.3/pr_13574.patch @@ -0,0 +1,22 @@ +--- services/project-history/app/js/UpdateTranslator.js ++++ services/project-history/app/js/UpdateTranslator.js +@@ -73,9 +73,18 @@ function _convertToChange(projectId, updateWithBlob) { + throw error + } + ++ let v2Authors ++ if (update.meta.user_id === 'anonymous-user') { ++ // history-v1 uses null to represent an anonymous author ++ v2Authors = [null] ++ } else { ++ // user_id is missing on resync operations that update the contents of a doc ++ v2Authors = _.compact([update.meta.user_id]) ++ } ++ + const rawChange = { + operations, +- v2Authors: _.compact([update.meta.user_id]), ++ v2Authors, + timestamp: new Date(update.meta.ts).toISOString(), + projectVersion, + v2DocVersions: Object.keys(v2DocVersions).length ? v2DocVersions : null,