Merge pull request #2817 from overleaf/ns-project-import-deletion-v1-handler

remove checks if project is in importing state

GitOrigin-RevId: f087cf04436b38b351b6985cecc9182256401cba
This commit is contained in:
nate stemen 2020-05-20 09:03:02 -04:00 committed by Copybot
parent 2479cb485a
commit f5b2640c82
4 changed files with 1 additions and 69 deletions

View file

@ -37,7 +37,6 @@ const { V1ConnectionError } = require('../Errors/Errors')
const Features = require('../../infrastructure/Features')
const BrandVariationsHandler = require('../BrandVariations/BrandVariationsHandler')
const { getUserAffiliations } = require('../Institutions/InstitutionsAPI')
const V1Handler = require('../V1/V1Handler')
const UserController = require('../User/UserController')
const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => {
@ -619,35 +618,7 @@ const ProjectController = {
if (err != null) {
return cb(err)
}
if (
(project.overleaf != null ? project.overleaf.id : undefined) ==
null ||
(project.tokens != null
? project.tokens.readAndWrite
: undefined) == null ||
Settings.projectImportingCheckMaxCreateDelta == null
) {
return cb(null, project)
}
const createDelta =
(new Date().getTime() -
new Date(project._id.getTimestamp()).getTime()) /
1000
if (
!(createDelta < Settings.projectImportingCheckMaxCreateDelta)
) {
return cb(null, project)
}
V1Handler.getDocExported(
project.tokens.readAndWrite,
(err, docExported) => {
if (err != null) {
return next(err)
}
project.exporting = docExported.exporting
cb(null, project)
}
)
cb(null, project)
}
)
},
@ -738,11 +709,6 @@ const ProjectController = {
return res.sendStatus(401)
}
if (project.exporting) {
res.render('project/importing', { bodyClasses: ['editor'] })
return
}
if (
subscription != null &&
subscription.freeTrial != null &&

View file

@ -102,29 +102,6 @@ module.exports = V1Handler = {
}
}
)
},
getDocExported(token, callback) {
// default to not exported
if (callback == null) {
callback = function(err, info) {}
}
if ((Settings.apis != null ? Settings.apis.v1 : undefined) == null) {
return callback(null, {
exported: false,
exporting: false
})
}
return V1Api.request(
{ url: `/api/v1/sharelatex/docs/${token}/exported_to_v2` },
function(err, response, body) {
if (err != null) {
return callback(err)
}
return callback(null, body)
}
)
}
}

View file

@ -259,16 +259,6 @@ module.exports = MockV1Api = {
}
)
app.get(
'/api/v1/sharelatex/docs/:token/exported_to_v2',
(req, res, next) => {
if (this.doc_exported[req.params.token] != null) {
return res.json(this.doc_exported[req.params.token])
}
return res.json({ exporting: false, exported: false })
}
)
app.get(
'/api/v1/sharelatex/docs/read_token/:token/exists',
(req, res, next) => {

View file

@ -177,7 +177,6 @@ describe('ProjectController', function() {
getUserAffiliations: this.getUserAffiliations
},
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher,
'../V1/V1Handler': {},
'../../models/Project': {}
}
})