Răsfoiți Sursa

Merge pull request #3112 from overleaf/ew-send-project-owner-id-to-tpds

add project_owner_user_id to tpds requests

GitOrigin-RevId: 3b83d6dd2eaa00e100e7fa84e403318a44282747
Shane Kilkelly 6 ani în urmă
părinte
comite
df32ea6dca

+ 6 - 3
services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js

@@ -36,7 +36,8 @@ async function addEntity(options) {
       headers: {
       headers: {
         sl_entity_rev: options.rev,
         sl_entity_rev: options.rev,
         sl_project_id: options.project_id,
         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),
       uri: buildTpdsUrl(userId, options.project_name, options.path),
       title: 'addFile',
       title: 'addFile',
@@ -86,7 +87,8 @@ async function deleteEntity(options) {
       method: 'delete',
       method: 'delete',
       headers: {
       headers: {
         sl_project_id: options.project_id,
         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),
       uri: buildTpdsUrl(userId, options.project_name, options.path),
       title: 'deleteEntity',
       title: 'deleteEntity',
@@ -156,7 +158,8 @@ async function moveEntity(options) {
       headers: {
       headers: {
         sl_project_id: options.project_id,
         sl_project_id: options.project_id,
         sl_entity_rev: options.rev,
         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: {
       json: {
         user_id: userId,
         user_id: userId,

+ 3 - 0
services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js

@@ -130,16 +130,19 @@ describe('TpdsUpdateSender', function() {
       )}${encodeURIComponent(path)}`
       )}${encodeURIComponent(path)}`
       job0.uri.should.equal(expectedUrl)
       job0.uri.should.equal(expectedUrl)
       job0.headers.sl_all_user_ids.should.equal(JSON.stringify([userId]))
       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
       const { group: group1, job: job1 } = this.request.secondCall.args[0].json
       group1.should.equal(collaberatorRef)
       group1.should.equal(collaberatorRef)
       job1.headers.sl_all_user_ids.should.equal(
       job1.headers.sl_all_user_ids.should.equal(
         JSON.stringify([collaberatorRef])
         JSON.stringify([collaberatorRef])
       )
       )
+      job1.headers.sl_project_owner_user_id.should.equal(userId)
 
 
       const { group: group2, job: job2 } = this.request.thirdCall.args[0].json
       const { group: group2, job: job2 } = this.request.thirdCall.args[0].json
       group2.should.equal(readOnlyRef)
       group2.should.equal(readOnlyRef)
       job2.headers.sl_all_user_ids.should.equal(JSON.stringify([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(
       this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith(
         {
         {