Parcourir la source

Revert "Initialise full project history for old projects (in background) when project opened (#4345)" (#4353)

This reverts commit 2da493c6023b362ced197b0533fa684c654a3827.

GitOrigin-RevId: b11dfff5cce1070c6b8113dc0988fae9ade0d39b
Thomas il y a 5 ans
Parent
commit
a84cf5f53b

+ 0 - 19
services/web/app/src/Features/Project/ProjectController.js

@@ -9,7 +9,6 @@ const { ObjectId } = require('mongodb')
 const ProjectDeleter = require('./ProjectDeleter')
 const ProjectDuplicator = require('./ProjectDuplicator')
 const ProjectCreationHandler = require('./ProjectCreationHandler')
-const ProjectHistoryHandler = require('./ProjectHistoryHandler')
 const EditorController = require('../Editor/EditorController')
 const ProjectHelper = require('./ProjectHelper')
 const metrics = require('@overleaf/metrics')
@@ -681,24 +680,6 @@ const ProjectController = {
         activate(cb) {
           InactiveProjectManager.reactivateProjectIfRequired(projectId, cb)
         },
-        ensureHistoryExists(cb) {
-          // enable full project history in background for older projects
-          if (!Settings.apis.project_history || !Features.hasFeature('saas')) {
-            return cb()
-          }
-          ProjectHistoryHandler.ensureHistoryExistsForProject(
-            projectId,
-            err => {
-              if (err) {
-                logger.error(
-                  { err, projectId },
-                  'error ensuring history exists for project'
-                )
-              }
-              cb()
-            }
-          )
-        },
         markAsOpened(cb) {
           // don't need to wait for this to complete
           ProjectUpdateHandler.markAsOpened(projectId, () => {})

+ 0 - 16
services/web/test/unit/src/Project/ProjectControllerTests.js

@@ -54,9 +54,6 @@ describe('ProjectController', function () {
         .stub()
         .callsArgWith(2, null, { _id: this.project_id }),
     }
-    this.ProjectHistoryHandler = {
-      ensureHistoryExistsForProject: sinon.stub().callsArg(1),
-    }
     this.SubscriptionLocator = { getUsersSubscription: sinon.stub() }
     this.LimitationsManager = { hasPaidSubscription: sinon.stub() }
     this.TagsHandler = { getAllTags: sinon.stub() }
@@ -143,7 +140,6 @@ describe('ProjectController', function () {
         './ProjectDeleter': this.ProjectDeleter,
         './ProjectDuplicator': this.ProjectDuplicator,
         './ProjectCreationHandler': this.ProjectCreationHandler,
-        './ProjectHistoryHandler': this.ProjectHistoryHandler,
         '../Editor/EditorController': this.EditorController,
         '../User/UserController': this.UserController,
         './ProjectHelper': this.ProjectHelper,
@@ -1028,18 +1024,6 @@ describe('ProjectController', function () {
       this.ProjectController.loadEditor(this.req, this.res)
     })
 
-    it('should ensureHistoryExistsForProject if saas and project_history enabled', function (done) {
-      this.Features.hasFeature.withArgs('saas').returns(true)
-      this.settings.apis.project_history = 'enabled'
-      this.res.render = (pageName, opts) => {
-        this.ProjectHistoryHandler.ensureHistoryExistsForProject
-          .calledWith(this.project_id)
-          .should.equal(true)
-        done()
-      }
-      this.ProjectController.loadEditor(this.req, this.res)
-    })
-
     it('should mark project as opened', function (done) {
       this.res.render = (pageName, opts) => {
         this.ProjectUpdateHandler.markAsOpened