mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #1961 from overleaf/jel-remove-force-import-feature-check
Remove checks for `force-import-to-v2` GitOrigin-RevId: f94e8b0fb2f7f4416759583d5ca02babec345120
This commit is contained in:
parent
d4a8f38736
commit
ed6891e66d
9 changed files with 64 additions and 150 deletions
|
@ -97,7 +97,7 @@ make test_acceptance_app_stop_service
|
|||
During development it is often useful to only run a subset of tests, which can be configured with arguments to the mocha CLI:
|
||||
|
||||
```
|
||||
make acceptance_test_run MOCHA_ARGS='--grep=AuthorizationManager'
|
||||
make test_acceptance_run MOCHA_GREP='AuthorizationManager'
|
||||
```
|
||||
|
||||
To run only the acceptance tests for a single module do:
|
||||
|
|
|
@ -14,7 +14,6 @@ let TokenAccessController
|
|||
const ProjectController = require('../Project/ProjectController')
|
||||
const AuthenticationController = require('../Authentication/AuthenticationController')
|
||||
const TokenAccessHandler = require('./TokenAccessHandler')
|
||||
const Features = require('../../infrastructure/Features')
|
||||
const Errors = require('../Errors/Errors')
|
||||
const logger = require('logger-sharelatex')
|
||||
const settings = require('settings-sharelatex')
|
||||
|
@ -280,11 +279,7 @@ module.exports = TokenAccessController = {
|
|||
|
||||
_handleV1Project(token, userId, redirectPath, res, next) {
|
||||
if (userId == null) {
|
||||
if (Features.hasFeature('force-import-to-v2')) {
|
||||
return res.render('project/v2-import', { loginRedirect: redirectPath })
|
||||
} else {
|
||||
return res.redirect(302, `/sign_in_to_v1?return_to=${redirectPath}`)
|
||||
}
|
||||
return res.render('project/v2-import', { loginRedirect: redirectPath })
|
||||
} else {
|
||||
return TokenAccessHandler.getV1DocInfo(token, userId, function(
|
||||
err,
|
||||
|
@ -299,17 +294,13 @@ module.exports = TokenAccessController = {
|
|||
if (doc_info.exported) {
|
||||
return next(new Errors.NotFoundError())
|
||||
}
|
||||
if (Features.hasFeature('force-import-to-v2')) {
|
||||
return res.render('project/v2-import', {
|
||||
projectId: token,
|
||||
hasOwner: doc_info.has_owner,
|
||||
name: doc_info.name || 'Untitled',
|
||||
hasAssignment: doc_info.has_assignment,
|
||||
brandInfo: doc_info.brand_info
|
||||
})
|
||||
} else {
|
||||
return res.redirect(302, `/sign_in_to_v1?return_to=${redirectPath}`)
|
||||
}
|
||||
return res.render('project/v2-import', {
|
||||
projectId: token,
|
||||
hasOwner: doc_info.has_owner,
|
||||
name: doc_info.name || 'Untitled',
|
||||
hasAssignment: doc_info.has_assignment,
|
||||
brandInfo: doc_info.brand_info
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,6 @@ module.exports = Features = {
|
|||
)
|
||||
case 'redirect-sl':
|
||||
return Settings.redirectToV2 != null
|
||||
case 'force-import-to-v2':
|
||||
return Settings.forceImportToV2
|
||||
default:
|
||||
throw new Error(`unknown feature: ${feature}`)
|
||||
}
|
||||
|
|
|
@ -332,46 +332,3 @@ script(type="text/ng-template", id="userProfileModalTemplate")
|
|||
.modal-footer
|
||||
button.btn.btn-info(ng-click="done()") #{translate("done")}
|
||||
|
||||
script(type="text/ng-template", id="v1ImportModalTemplate")
|
||||
.modal-header
|
||||
button.close(ng-click="dismiss()") ×
|
||||
h3 Move Project to Overleaf v2
|
||||
|
||||
.modal-body.v1-import-wrapper
|
||||
.v1-import-row
|
||||
.v1-import-col.v1-import-col--left
|
||||
img.v1-import-img(
|
||||
src="/img/v1-import/v2-editor.png"
|
||||
alt="The new V2 editor."
|
||||
)
|
||||
.v1-import-col
|
||||
h2.v1-import-title #[strong Warning:] Some Overleaf v1 features aren't supported yet
|
||||
p We are still working hard to bring some Overleaf v1 features to the v2 editor. In v2:
|
||||
ul
|
||||
li There is no <strong>CiteULike</strong> integration
|
||||
li Some <strong>Journals and Services in the Submit menu</strong> don't support direct submissions yet
|
||||
.v1-import-cta
|
||||
p
|
||||
strong Please note: you cannot move this project back to v1 once you have moved it to v2.
|
||||
p Are you sure you want to move #[strong {{project.name}}] into Overleaf v2?
|
||||
|
||||
.modal-footer.v1-import-footer
|
||||
form(
|
||||
async-form="v1Import",
|
||||
name="v1ImportForm",
|
||||
action="{{'/overleaf/project/'+ project.id + '/import'}}"
|
||||
method="POST"
|
||||
ng-cloak
|
||||
)
|
||||
input(name='_csrf', type='hidden', value=csrfToken)
|
||||
form-messages(for="v1ImportForm")
|
||||
if settings.overleaf && settings.overleaf.host
|
||||
a.btn.btn-primary.v1-import-btn(
|
||||
ng-href='/sign_in_to_v1?return_to=/{{project.id}}'
|
||||
ng-class="{disabled: v1ImportForm.inflight || v1ImportForm.response.success}"
|
||||
) No thanks, open in v1
|
||||
input.btn.btn-primary.v1-import-btn(
|
||||
type="submit",
|
||||
value="Yes, move project to v2"
|
||||
ng-disabled="v1ImportForm.inflight || v1ImportForm.response.success"
|
||||
)
|
||||
|
|
|
@ -7,19 +7,7 @@ td.project-list-table-name-cell(ng-if-start="project.isV1Project")
|
|||
tooltip-append-to-body="true"
|
||||
)
|
||||
span.project-list-table-name
|
||||
if hasFeature('force-import-to-v2')
|
||||
a.projectName(href='/{{project.id}}') {{project.name}}
|
||||
else
|
||||
button.btn.btn-link.projectName(
|
||||
ng-click="openV1ImportModal(project)"
|
||||
stop-propagation="click"
|
||||
ng-show="project.accessLevel == 'owner'"
|
||||
) {{project.name}}
|
||||
a.projectName(
|
||||
href='/sign_in_to_v1?return_to=/{{project.id}}'
|
||||
target="_blank"
|
||||
ng-hide="project.accessLevel == 'owner'"
|
||||
) {{project.name}}
|
||||
a.projectName(href='/{{project.id}}') {{project.name}}
|
||||
|
||||
td.project-list-table-owner-cell
|
||||
span.owner {{ownerName(project)}}
|
||||
|
|
|
@ -225,19 +225,11 @@ block content
|
|||
div.modal-body#delete-account-modal
|
||||
p !{translate("delete_account_warning_message_3")}
|
||||
if settings.createV1AccountOnLogin && settings.overleaf
|
||||
if settings.forceImportToV2
|
||||
p
|
||||
strong
|
||||
| Your Overleaf v2 projects will be deleted if you delete your account.
|
||||
| If you want to remove any remaining Overleaf v1 projects in your account,
|
||||
| please first make sure they are imported to Overleaf v2.
|
||||
else
|
||||
p
|
||||
strong
|
||||
| This will also delete your user account on #[a(href='/sign_in_to_v1?return_to=/dash%3Fprefer-v1-dash%3D1' target="_blank") Overleaf v1].
|
||||
| If you want to remove your projects from Overleaf v1, you must do this before you
|
||||
| delete your account by going to your My Projects page in Overleaf v1, moving your
|
||||
| projects to the Trash, and then from there either ‘leaving’ or ‘purging’ them, as appropriate.
|
||||
p
|
||||
strong
|
||||
| Your Overleaf v2 projects will be deleted if you delete your account.
|
||||
| If you want to remove any remaining Overleaf v1 projects in your account,
|
||||
| please first make sure they are imported to Overleaf v2.
|
||||
|
||||
if settings.overleaf && !hasPassword
|
||||
p
|
||||
|
|
|
@ -699,19 +699,6 @@ define(['base', 'main/project-list/services/project-list'], function(App) {
|
|||
return (window.location = path)
|
||||
}
|
||||
|
||||
$scope.openV1ImportModal = project =>
|
||||
$modal.open({
|
||||
templateUrl: 'v1ImportModalTemplate',
|
||||
controller: 'V1ImportModalController',
|
||||
size: 'lg',
|
||||
windowClass: 'v1-import-modal',
|
||||
resolve: {
|
||||
project() {
|
||||
return project
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const markTagAsSelected = id => {
|
||||
for (let tag of $scope.tags) {
|
||||
if (tag._id === id) {
|
||||
|
|
|
@ -861,25 +861,21 @@ describe('TokenAccess', function() {
|
|||
this.owner,
|
||||
unimportedV1Token,
|
||||
(response, body) => {
|
||||
expect(response.statusCode).to.equal(302)
|
||||
return expect(response.headers.location).to.equal(
|
||||
'/sign_in_to_v1?return_to=/123abc'
|
||||
)
|
||||
expect(response.statusCode).to.equal(200)
|
||||
expect(body).to.contain('has not been imported to v2 yet.')
|
||||
},
|
||||
done
|
||||
)
|
||||
})
|
||||
|
||||
it('should redirect read only token to v1', function(done) {
|
||||
it('should show import project page', function(done) {
|
||||
const unimportedV1Token = 'abcd'
|
||||
return try_read_only_token_access(
|
||||
this.owner,
|
||||
unimportedV1Token,
|
||||
(response, body) => {
|
||||
expect(response.statusCode).to.equal(302)
|
||||
return expect(response.headers.location).to.equal(
|
||||
'/sign_in_to_v1?return_to=/read/abcd'
|
||||
)
|
||||
expect(response.statusCode).to.equal(200)
|
||||
expect(body).to.contain('has not been imported to v2 yet.')
|
||||
},
|
||||
done
|
||||
)
|
||||
|
|
|
@ -424,15 +424,16 @@ describe('TokenAccessController', function() {
|
|||
)
|
||||
})
|
||||
|
||||
it('should redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(1)
|
||||
expect(
|
||||
this.res.redirect.calledWith(
|
||||
302,
|
||||
'/sign_in_to_v1?return_to=/123abc'
|
||||
)
|
||||
).to.equal(true)
|
||||
return done()
|
||||
it('should not redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(0)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should show project import page', function(done) {
|
||||
expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
||||
true
|
||||
)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1102,6 +1103,7 @@ describe('TokenAccessController', function() {
|
|||
this.req = new MockRequest()
|
||||
this.res = new MockResponse()
|
||||
this.res.redirect = sinon.stub()
|
||||
this.res.render = sinon.stub()
|
||||
this.next = sinon.stub()
|
||||
this.req.params['read_only_token'] = 'abcd'
|
||||
this.TokenAccessHandler.findProjectWithReadOnlyToken = sinon
|
||||
|
@ -1110,22 +1112,21 @@ describe('TokenAccessController', function() {
|
|||
this.TokenAccessHandler.checkV1ProjectExported = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, null, false)
|
||||
return this.TokenAccessController.readOnlyToken(
|
||||
this.TokenAccessController.readOnlyToken(
|
||||
this.req,
|
||||
this.res,
|
||||
this.next
|
||||
)
|
||||
})
|
||||
|
||||
it('should redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(1)
|
||||
expect(
|
||||
this.res.redirect.calledWith(
|
||||
302,
|
||||
'/sign_in_to_v1?return_to=/read/abcd'
|
||||
)
|
||||
).to.equal(true)
|
||||
return done()
|
||||
it('should not redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(0)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should show project import page', function(done) {
|
||||
expect(this.res.render.calledWith('project/v2-import')).to.equal(true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1756,22 +1757,24 @@ describe('TokenAccessController', function() {
|
|||
exists: true,
|
||||
exported: false
|
||||
})
|
||||
return this.TokenAccessController.readOnlyToken(
|
||||
this.res.render = sinon.stub()
|
||||
this.TokenAccessController.readOnlyToken(
|
||||
this.req,
|
||||
this.res,
|
||||
this.next
|
||||
)
|
||||
})
|
||||
|
||||
it('should redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(1)
|
||||
expect(
|
||||
this.res.redirect.calledWith(
|
||||
302,
|
||||
`/sign_in_to_v1?return_to=/read/${this.readOnlyToken}`
|
||||
)
|
||||
).to.equal(true)
|
||||
return done()
|
||||
it('should not redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(0)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should show project import page', function(done) {
|
||||
expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
||||
true
|
||||
)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1810,22 +1813,24 @@ describe('TokenAccessController', function() {
|
|||
exists: true,
|
||||
exported: false
|
||||
})
|
||||
return this.TokenAccessController.readOnlyToken(
|
||||
this.res.render = sinon.stub()
|
||||
this.TokenAccessController.readOnlyToken(
|
||||
this.req,
|
||||
this.res,
|
||||
this.next
|
||||
)
|
||||
})
|
||||
|
||||
it('should redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(1)
|
||||
expect(
|
||||
this.res.redirect.calledWith(
|
||||
302,
|
||||
`/sign_in_to_v1?return_to=/read/${this.readOnlyToken}`
|
||||
)
|
||||
).to.equal(true)
|
||||
return done()
|
||||
it('should not redirect to v1', function(done) {
|
||||
expect(this.res.redirect.callCount).to.equal(0)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should show project import page', function(done) {
|
||||
expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
||||
true
|
||||
)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue