From df32ea6dca84ab9071c0e0a8042cac8e591104ac Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 16 Sep 2020 09:51:25 +0100 Subject: [PATCH] Merge pull request #3112 from overleaf/ew-send-project-owner-id-to-tpds add project_owner_user_id to tpds requests GitOrigin-RevId: 3b83d6dd2eaa00e100e7fa84e403318a44282747 --- .../src/Features/ThirdPartyDataStore/TpdsUpdateSender.js | 9 ++++++--- .../src/ThirdPartyDataStore/TpdsUpdateSenderTests.js | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js index 593a2f84de..a842f989f1 100644 --- a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js +++ b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js @@ -36,7 +36,8 @@ async function addEntity(options) { headers: { sl_entity_rev: options.rev, sl_project_id: options.project_id, - sl_all_user_ids: JSON.stringify([userId]) + sl_all_user_ids: JSON.stringify([userId]), + sl_project_owner_user_id: projectUserIds[0] }, uri: buildTpdsUrl(userId, options.project_name, options.path), title: 'addFile', @@ -86,7 +87,8 @@ async function deleteEntity(options) { method: 'delete', headers: { sl_project_id: options.project_id, - sl_all_user_ids: JSON.stringify([userId]) + sl_all_user_ids: JSON.stringify([userId]), + sl_project_owner_user_id: projectUserIds[0] }, uri: buildTpdsUrl(userId, options.project_name, options.path), title: 'deleteEntity', @@ -156,7 +158,8 @@ async function moveEntity(options) { headers: { sl_project_id: options.project_id, sl_entity_rev: options.rev, - sl_all_user_ids: JSON.stringify([userId]) + sl_all_user_ids: JSON.stringify([userId]), + sl_project_owner_user_id: projectUserIds[0] }, json: { user_id: userId, diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js index 66b62d4e1b..e1061bf191 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js @@ -130,16 +130,19 @@ describe('TpdsUpdateSender', function() { )}${encodeURIComponent(path)}` job0.uri.should.equal(expectedUrl) job0.headers.sl_all_user_ids.should.equal(JSON.stringify([userId])) + job0.headers.sl_project_owner_user_id.should.equal(userId) const { group: group1, job: job1 } = this.request.secondCall.args[0].json group1.should.equal(collaberatorRef) job1.headers.sl_all_user_ids.should.equal( JSON.stringify([collaberatorRef]) ) + job1.headers.sl_project_owner_user_id.should.equal(userId) const { group: group2, job: job2 } = this.request.thirdCall.args[0].json group2.should.equal(readOnlyRef) job2.headers.sl_all_user_ids.should.equal(JSON.stringify([readOnlyRef])) + job2.headers.sl_project_owner_user_id.should.equal(userId) this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( {