mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
* [web] Reject tracked changes notifications feat: adding new tests feat: adding rejected changes notifications feat: adding tests for rejectchanges feat: updating tests for rejecting notifications; feat: adding in rejecting user, and improving subject and activity line fix: moving to a params object instead of positionals for email building feat: updating to use events triggered from applyUpdate in document-updater feat: updating to send rejected author ids with rejected change notification instead of change ids feat: moving rejected author notification determination to updateManager instead of RangesManager, which is used by other paths feat: only map to author if changes were made * fix: gate by user status not project status * fix: unit tests post-rebase --------- Co-authored-by: Kristina Hjertberg <kristina.hjertberg@overleaf.com> GitOrigin-RevId: f992e1885c47d1a6cf776740769d6d4763f3cb7c
40 lines
851 B
JavaScript
40 lines
851 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[]} rejectedChangeAuthorIds
|
|
* @param {string | undefined} userId
|
|
*/
|
|
async function notifyTrackChangesRejected(
|
|
projectId,
|
|
docId,
|
|
rejectedChangeAuthorIds,
|
|
userId
|
|
) {
|
|
const url = new URL(
|
|
`/project/${projectId}/doc/${docId}/changes/reject`,
|
|
Settings.apis.web.url
|
|
)
|
|
|
|
await fetchNothing(url, {
|
|
method: 'POST',
|
|
json: { rejectedChangeAuthorIds, userId },
|
|
basicAuth: {
|
|
user: Settings.apis.web.user,
|
|
password: Settings.apis.web.pass,
|
|
},
|
|
signal: AbortSignal.timeout(MAX_HTTP_REQUEST_LENGTH),
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
promises: {
|
|
notifyTrackChangesRejected,
|
|
},
|
|
}
|