Files
overleaf-cep/services/document-updater/app/js/WebApiManager.js
Domagoj Kriskovic 8f0979d6a2 Trigger reject tracked changes notification from document-updater
GitOrigin-RevId: 9ac47490d052b3058931ca250f4090e6576f56b2
2026-05-07 08:06:57 +00:00

40 lines
833 B
JavaScript

// @ts-check
const Settings = require('@overleaf/settings')
const { fetchNothing } = require('@overleaf/fetch-utils')
const MAX_HTTP_REQUEST_LENGTH = 5000
/**
* @param {string} projectId
* @param {string} docId
* @param {string[]} rejectedChangeIds
* @param {string | undefined} userId
*/
async function notifyTrackChangesRejected(
projectId,
docId,
rejectedChangeIds,
userId
) {
const url = new URL(
`/project/${projectId}/doc/${docId}/changes/reject`,
Settings.apis.web.url
)
await fetchNothing(url, {
method: 'POST',
json: { rejectedChangeIds, userId },
basicAuth: {
user: Settings.apis.web.user,
password: Settings.apis.web.pass,
},
signal: AbortSignal.timeout(MAX_HTTP_REQUEST_LENGTH),
})
}
module.exports = {
promises: {
notifyTrackChangesRejected,
},
}