Просмотр исходного кода

Merge pull request #1313 from sharelatex/as-import-copy

Improved copy for import status page

GitOrigin-RevId: fa3e6792e7c703ea3a5127186385dcf661fef5e8
Simon Detheridge 7 лет назад
Родитель
Сommit
ec1867198f

+ 3 - 1
services/web/app/coffee/Features/TokenAccess/TokenAccessController.coffee

@@ -145,7 +145,9 @@ module.exports = TokenAccessController =
 					return res.render('project/v2-import', {
 						projectId: token,
 						hasOwner: doc_info.has_owner,
-						name: doc_info.name
+						name: doc_info.name,
+						hasAssignment: doc_info.has_assignment,
+						brandInfo: doc_info.brand_info
 					})
 				else
 					return res.redirect(302, "/sign_in_to_v1?return_to=#{redirectPath}")

+ 26 - 17
services/web/app/views/project/v2-import.pug

@@ -62,20 +62,29 @@ block content
 								ng-disabled="v2ZipDownloadForm.inflight || v2ZipDownloadForm.success"
 							)
 
-					h3 What can I do once I've moved my project?
-					ul
-						li New & Improved Editor
-						li Tracked Changed & Comments
-						li Git access (still supported)
-
-					h3 Is there anything I can't do once I've moved my project to
-					ul
-						li Assignments
-						li F1000 Research Workflow
-						li
-							| Files you have imported from CiteULike and Plotly will become
-							| ordinary files, but you can still use these services by
-							| downloading and uploading files
-						li
-							| Publishing to Figshare and PeerWith are not presently available,
-							| but improved versions will be coming back
+					.row-spaced.text-center
+						if hasAssignment
+							p
+								| #[span.fa.fa-exclamation-triangle]
+								| This project is an assignment, and the assignment toolkit is
+								| no longer supported in Overleaf v2. When you move it to
+								| Overleaf v2, it will become a normal project.
+								| #[a(href="https://www.overleaf.com/learn/how-to/Overleaf_v2_FAQ#assignment-tools") Please see our FAQ]
+								| for more information or contact your instructor if you haven't
+								| already submitted it.
+						else if brandInfo == 'f1000'
+							p
+								| #[span.fa.fa-exclamation-triangle]
+								| This project is an F1000Research article, and our integration
+								| with F1000Research has changed in Overleaf v2.
+								| #[a(href="https://www.overleaf.com/learn/how-to/Overleaf_v2_FAQ#f1000research") Find out more about moving to Overleaf v2]
+						else if brandInfo == 'wellcome'
+							p
+								| #[span.fa.fa-exclamation-triangle]
+								| This project is an Wellcome Open Research article, and our
+								| integration with Wellcome Open Research has changed in
+								| Overleaf v2.
+								| #[a(href="https://www.overleaf.com/learn/how-to/Overleaf_v2_FAQ#f1000research") Find out more about moving to Overleaf v2]
+						else
+							a(href="https://www.overleaf.com/learn/how-to/Overleaf_v2_FAQ")
+								| Find out more about moving to Overleaf v2

+ 126 - 10
services/web/test/unit/coffee/TokenAccess/TokenAccessControllerTests.coffee

@@ -264,7 +264,6 @@ describe "TokenAccessController", ->
 					describe 'when project was not exported from v1', ->
 						beforeEach ->
 							@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-									allow: true
 									exists: true
 									exported: false
 								})
@@ -285,11 +284,12 @@ describe "TokenAccessController", ->
 						describe 'with project name', ->
 							beforeEach ->
 								@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-									allow: true
 									exists: true
 									exported: false
 									has_owner: true
 									name: 'A title'
+									has_assignment: false
+									brand_info: null
 								})
 								@TokenAccessController.readAndWriteToken @req, @res, @next
 
@@ -300,6 +300,8 @@ describe "TokenAccessController", ->
 										projectId: '123abc'
 										name: 'A title'
 										hasOwner: true
+										hasAssignment: false
+										brandInfo: null
 									}
 								)).to.equal true
 								done()
@@ -307,11 +309,12 @@ describe "TokenAccessController", ->
 						describe 'with project owner', ->
 							beforeEach ->
 								@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-									allow: true
 									exists: true
 									exported: false
 									has_owner: true
 									name: 'A title'
+									has_assignment: false
+									brand_info: null
 								})
 								@TokenAccessController.readAndWriteToken @req, @res, @next
 
@@ -319,9 +322,11 @@ describe "TokenAccessController", ->
 								expect(@res.render.calledWith(
 									'project/v2-import',
 									{
-										projectId: '123abc',
+										projectId: '123abc'
 										hasOwner: true
 										name: 'A title'
+										hasAssignment: false
+										brandInfo: null
 									}
 								)).to.equal true
 								done()
@@ -329,11 +334,12 @@ describe "TokenAccessController", ->
 						describe 'without project owner', ->
 							beforeEach ->
 								@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-									allow: true
 									exists: true
 									exported: false
 									has_owner: false
 									name: 'A title'
+									has_assignment: false
+									brand_info: null
 								})
 								@TokenAccessController.readAndWriteToken @req, @res, @next
 
@@ -343,7 +349,59 @@ describe "TokenAccessController", ->
 									{
 										projectId: '123abc',
 										hasOwner: false
-										name: 'A title'
+										name: 'A title',
+										hasAssignment: false,
+										brandInfo: null
+									}
+								)).to.equal true
+								done()
+
+						describe 'with assignment', ->
+							beforeEach ->
+								@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
+									exists: true
+									exported: false
+									has_owner: false
+									name: 'A title'
+									has_assignment: true
+									brand_info: null
+								})
+								@TokenAccessController.readAndWriteToken @req, @res, @next
+
+							it 'should render v2-import page', (done) ->
+								expect(@res.render.calledWith(
+									'project/v2-import',
+									{
+										projectId: '123abc',
+										hasOwner: false
+										name: 'A title',
+										hasAssignment: true,
+										brandInfo: null
+									}
+								)).to.equal true
+								done()
+
+						describe 'with brand info', ->
+							beforeEach ->
+								@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
+									exists: true
+									exported: false
+									has_owner: false
+									name: 'A title'
+									has_assignment: false
+									brand_info: 'wellcome'
+								})
+								@TokenAccessController.readAndWriteToken @req, @res, @next
+
+							it 'should render v2-import page', (done) ->
+								expect(@res.render.calledWith(
+									'project/v2-import',
+									{
+										projectId: '123abc',
+										hasOwner: false
+										name: 'A title',
+										hasAssignment: false,
+										brandInfo: 'wellcome'
 									}
 								)).to.equal true
 								done()
@@ -364,7 +422,6 @@ describe "TokenAccessController", ->
 					describe 'when project was exported from v1', ->
 						beforeEach ->
 							@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-									allow: true
 									exists: true
 									exported: true
 								})
@@ -672,11 +729,12 @@ describe "TokenAccessController", ->
 				describe 'with project name', ->
 					beforeEach ->
 						@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-							allow: true
 							exists: true
 							exported: false
 							has_owner: true
 							name: 'A title'
+							has_assignment: false
+							brand_info: null
 						})
 						@TokenAccessController.readOnlyToken @req, @res, @next
 
@@ -687,6 +745,8 @@ describe "TokenAccessController", ->
 								projectId: 'abcd'
 								name: 'A title'
 								hasOwner: true
+								hasAssignment: false
+								brandInfo: null
 							}
 						)).to.equal true
 						done()
@@ -694,11 +754,12 @@ describe "TokenAccessController", ->
 				describe 'with project owner', ->
 					beforeEach ->
 						@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-							allow: true
 							exists: true
 							exported: false
 							has_owner: true
 							name: 'A title'
+							has_assignment: false
+							brand_info: null
 						})
 						@TokenAccessController.readOnlyToken @req, @res, @next
 
@@ -709,6 +770,8 @@ describe "TokenAccessController", ->
 								projectId: 'abcd',
 								hasOwner: true
 								name: 'A title'
+								hasAssignment: false
+								brandInfo: null
 							}
 						)).to.equal true
 						done()
@@ -716,11 +779,62 @@ describe "TokenAccessController", ->
 				describe 'without project owner', ->
 					beforeEach ->
 						@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
-							allow: true
 							exists: true
 							exported: false
 							has_owner: false
 							name: 'A title'
+							has_assignment: false
+							brand_info: null
+						})
+						@TokenAccessController.readOnlyToken @req, @res, @next
+
+					it 'should render v2-import page', (done) ->
+						expect(@res.render.calledWith(
+							'project/v2-import',
+							{
+								projectId: 'abcd',
+								hasOwner: false
+								name: 'A title'
+								hasAssignment: false
+								brandInfo: null
+							}
+						)).to.equal true
+						done()
+
+				describe 'with assignment', ->
+					beforeEach ->
+						@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
+							exists: true
+							exported: false
+							has_owner: false
+							name: 'A title'
+							has_assignment: true
+							brand_info: null
+						})
+						@TokenAccessController.readOnlyToken @req, @res, @next
+
+					it 'should render v2-import page', (done) ->
+						expect(@res.render.calledWith(
+							'project/v2-import',
+							{
+								projectId: 'abcd',
+								hasOwner: false
+								name: 'A title'
+								hasAssignment: true
+								brandInfo: null
+							}
+						)).to.equal true
+						done()
+
+				describe 'with brand info', ->
+					beforeEach ->
+						@TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, {
+							exists: true
+							exported: false
+							has_owner: false
+							name: 'A title'
+							has_assignment: false
+							brand_info: 'f1000'
 						})
 						@TokenAccessController.readOnlyToken @req, @res, @next
 
@@ -731,6 +845,8 @@ describe "TokenAccessController", ->
 								projectId: 'abcd',
 								hasOwner: false
 								name: 'A title'
+								hasAssignment: false
+								brandInfo: 'f1000'
 							}
 						)).to.equal true
 						done()