Merge pull request #17105 from overleaf/jpa-tpds-cleanup

[misc] cleanup for tpds queues

GitOrigin-RevId: 8a501a692fa20d8956ad9dc4fccc0447c9f6fbe5
This commit is contained in:
Jakob Ackermann 2024-02-16 10:30:31 +00:00 committed by Copybot
parent cdca83d94e
commit 4804cd68a5
3 changed files with 15 additions and 65 deletions

2
package-lock.json generated
View file

@ -46087,7 +46087,6 @@
"@overleaf/o-error": "*", "@overleaf/o-error": "*",
"@overleaf/redis-wrapper": "*", "@overleaf/redis-wrapper": "*",
"@overleaf/settings": "*", "@overleaf/settings": "*",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"dtrace-provider": "^0.8.8", "dtrace-provider": "^0.8.8",
@ -54957,7 +54956,6 @@
"@overleaf/o-error": "*", "@overleaf/o-error": "*",
"@overleaf/redis-wrapper": "*", "@overleaf/redis-wrapper": "*",
"@overleaf/settings": "*", "@overleaf/settings": "*",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"chai": "^4.3.6", "chai": "^4.3.6",

View file

@ -55,8 +55,6 @@ async function addEntity(params) {
sl_entity_type: entityType, sl_entity_type: entityType,
sl_entity_rev: rev, sl_entity_rev: rev,
sl_project_id: projectId, sl_project_id: projectId,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
sl_folder_id: folderId, sl_folder_id: folderId,
}, },
uri: buildTpdsUrl(userId, projectName, path), uri: buildTpdsUrl(userId, projectName, path),
@ -124,8 +122,6 @@ async function deleteEntity(params) {
method: 'delete', method: 'delete',
headers: { headers: {
sl_project_id: projectId, sl_project_id: projectId,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
sl_entity_id: entityId, sl_entity_id: entityId,
sl_entity_type: entityType, sl_entity_type: entityType,
}, },
@ -135,7 +131,6 @@ async function deleteEntity(params) {
// would be moved to a POST endpoint. // would be moved to a POST endpoint.
json: { subtreeEntityIds }, json: { subtreeEntityIds },
title: 'deleteEntity', title: 'deleteEntity',
sl_all_user_ids: JSON.stringify([userId]),
} }
await enqueue(userId, 'standardHttpRequest', job) await enqueue(userId, 'standardHttpRequest', job)
@ -145,14 +140,12 @@ async function deleteEntity(params) {
async function createProject(params) { async function createProject(params) {
if (!tpdsUrl) return // Overleaf Community Edition/Server Pro if (!tpdsUrl) return // Overleaf Community Edition/Server Pro
const { projectId, projectName, ownerId, userId } = params const { projectId, projectName, userId } = params
const job = { const job = {
method: 'post', method: 'post',
headers: { headers: {
sl_project_id: projectId.toString(), sl_project_id: projectId.toString(),
sl_all_user_ids: JSON.stringify([userId.toString()]),
sl_project_owner_user_id: ownerId.toString(),
}, },
uri: Path.join( uri: Path.join(
tpdsUrl, tpdsUrl,
@ -163,7 +156,6 @@ async function createProject(params) {
encodeURIComponent(projectName) encodeURIComponent(projectName)
), ),
title: 'createProject', title: 'createProject',
sl_all_user_ids: JSON.stringify([userId]),
} }
await enqueue(userId, 'standardHttpRequest', job) await enqueue(userId, 'standardHttpRequest', job)
@ -217,8 +209,6 @@ async function moveEntity(params) {
const headers = { const headers = {
sl_project_id: projectId, sl_project_id: projectId,
sl_entity_rev: rev, sl_entity_rev: rev,
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: projectUserIds[0],
} }
if (entityId != null) { if (entityId != null) {
headers.sl_entity_id = entityId headers.sl_entity_id = entityId

View file

@ -134,10 +134,7 @@ describe('TpdsUpdateSender', function () {
uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent( uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent(
projectName projectName
)}${encodeURIComponent(path)}`, )}${encodeURIComponent(path)}`,
headers: { headers: {},
sl_all_user_ids: JSON.stringify([userId]),
sl_project_owner_user_id: userId,
},
}, },
}, },
} }
@ -148,12 +145,6 @@ describe('TpdsUpdateSender', function () {
{ {
json: { json: {
group: collaberatorRef, group: collaberatorRef,
job: {
headers: {
sl_all_user_ids: JSON.stringify([collaberatorRef]),
sl_project_owner_user_id: userId,
},
},
}, },
} }
) )
@ -163,12 +154,7 @@ describe('TpdsUpdateSender', function () {
{ {
json: { json: {
group: readOnlyRef, group: readOnlyRef,
job: { job: {},
headers: {
sl_all_user_ids: JSON.stringify([readOnlyRef]),
sl_project_owner_user_id: userId,
},
},
}, },
} }
) )
@ -199,9 +185,7 @@ describe('TpdsUpdateSender', function () {
projectName projectName
)}${encodeURIComponent(path)}`, )}${encodeURIComponent(path)}`,
streamOrigin: `${this.docstoreUrl}/project/${projectId}/doc/${docId}/raw`, streamOrigin: `${this.docstoreUrl}/project/${projectId}/doc/${docId}/raw`,
headers: { headers: {},
sl_all_user_ids: JSON.stringify([userId]),
},
}, },
}, },
} }
@ -213,9 +197,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: collaberatorRef, group: collaberatorRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
}, },
}, },
} }
@ -227,9 +209,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: readOnlyRef, group: readOnlyRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
}, },
}, },
} }
@ -258,9 +238,7 @@ describe('TpdsUpdateSender', function () {
uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent( uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent(
projectName projectName
)}${encodeURIComponent(path)}`, )}${encodeURIComponent(path)}`,
headers: { headers: {},
sl_all_user_ids: JSON.stringify([userId]),
},
json: { subtreeEntityIds }, json: { subtreeEntityIds },
}, },
}, },
@ -273,9 +251,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: collaberatorRef, group: collaberatorRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
}, },
}, },
} }
@ -287,9 +263,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: readOnlyRef, group: readOnlyRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
}, },
}, },
} }
@ -320,9 +294,7 @@ describe('TpdsUpdateSender', function () {
startPath: `/${projectName}/${startPath}`, startPath: `/${projectName}/${startPath}`,
endPath: `/${projectName}/${endPath}`, endPath: `/${projectName}/${endPath}`,
}, },
headers: { headers: {},
sl_all_user_ids: JSON.stringify([userId]),
},
}, },
}, },
} }
@ -334,9 +306,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: collaberatorRef, group: collaberatorRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
}, },
}, },
} }
@ -348,9 +318,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: readOnlyRef, group: readOnlyRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
}, },
}, },
} }
@ -380,9 +348,7 @@ describe('TpdsUpdateSender', function () {
startPath: oldProjectName, startPath: oldProjectName,
endPath: newProjectName, endPath: newProjectName,
}, },
headers: { headers: {},
sl_all_user_ids: JSON.stringify([userId]),
},
}, },
}, },
} }
@ -394,9 +360,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: collaberatorRef, group: collaberatorRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([collaberatorRef]),
},
}, },
}, },
} }
@ -408,9 +372,7 @@ describe('TpdsUpdateSender', function () {
json: { json: {
group: readOnlyRef, group: readOnlyRef,
job: { job: {
headers: { headers: {},
sl_all_user_ids: JSON.stringify([readOnlyRef]),
},
}, },
}, },
} }