Merge pull request #720 from sharelatex/mm-export-v1projectid

Include project's and user's v1 ID in export requests
This commit is contained in:
Hugh O'Brien 2018-07-05 12:12:35 +01:00 committed by GitHub
commit a230b5efab
2 changed files with 11 additions and 2 deletions

View file

@ -31,7 +31,7 @@ module.exports = ExportsHandler = self =
ProjectLocator.findRootDoc {project: results.project, project_id: project_id}, cb
]
user: (cb) ->
UserGetter.getUser user_id, {first_name: 1, last_name: 1, email: 1}, cb
UserGetter.getUser user_id, {first_name: 1, last_name: 1, email: 1, overleaf: 1}, cb
historyVersion: (cb) ->
self._requestVersion project_id, cb
@ -56,12 +56,14 @@ module.exports = ExportsHandler = self =
rootDocPath: rootDoc[1]?.fileSystem
historyId: project.overleaf?.history?.id
historyVersion: historyVersion
v1ProjectId: project.overleaf?.id
user:
id: user_id
firstName: user.first_name
lastName: user.last_name
email: user.email
orcidId: null # until v2 gets ORCID
v1UserId: user.overleaf?.id
destination:
brandVariationId: brand_variation_id
options:

View file

@ -64,6 +64,7 @@ describe 'ExportsHandler', ->
@project =
id: @project_id
overleaf:
id: @project_history_id # for projects imported from v1
history:
id: @project_history_id
@user =
@ -71,6 +72,8 @@ describe 'ExportsHandler', ->
first_name: 'Arthur'
last_name: 'Author'
email: 'arthur.author@arthurauthoring.org'
overleaf:
id: 876
@rootDocPath = 'main.tex'
@historyVersion = 777
@ProjectGetter.getProject = sinon.stub().yields(null, @project)
@ -90,18 +93,20 @@ describe 'ExportsHandler', ->
.should.equal true
it "should return export data", ->
expected_export_data =
expected_export_data =
project:
id: @project_id
rootDocPath: @rootDocPath
historyId: @project_history_id
historyVersion: @historyVersion
v1ProjectId: @project_history_id
user:
id: @user_id
firstName: @user.first_name
lastName: @user.last_name
email: @user.email
orcidId: null
v1UserId: 876
destination:
brandVariationId: @brand_variation_id
options:
@ -126,12 +131,14 @@ describe 'ExportsHandler', ->
rootDocPath: @rootDocPath
historyId: @project_history_id
historyVersion: @historyVersion
v1ProjectId: @project_history_id
user:
id: @user_id
firstName: @custom_first_name
lastName: @custom_last_name
email: @user.email
orcidId: null
v1UserId: 876
destination:
brandVariationId: @brand_variation_id
options: