Reject tracked changes notifications (#32917)

* [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
This commit is contained in:
Jimmy Domagala-Tang
2026-05-13 04:22:47 -04:00
committed by Copybot
parent 5e3561aedc
commit bc2f5ae746
6 changed files with 53 additions and 12 deletions

View File

@@ -287,7 +287,7 @@ describe('RangesManager', function () {
newDocLines,
{ historyRangesSupport: true }
)
expect(result.removedChangeIds).to.deep.equal(['1'])
expect(result.removedChangeIds).to.deep.equal([ranges.changes[0].id])
})
})

View File

@@ -536,12 +536,40 @@ describe('UpdateManager', function () {
describe('when tracked changes are rejected', function () {
beforeEach(async function () {
this.removedChangeIds = ['change-1', 'change-2']
this.rejectedChangeAuthorIds = ['author-1', 'author-2']
// The ranges that getDoc returned must include the changes whose IDs
// RangesManager reports as removed so UpdateManager can look up the
// authors locally.
this.ranges = {
changes: [
{
id: 'change-1',
metadata: { user_id: 'author-1' },
},
{
id: 'change-2',
metadata: { user_id: 'author-2' },
},
{
id: 'change-untouched',
metadata: { user_id: 'author-3' },
},
],
}
this.DocumentManager.promises.getDoc.resolves({
lines: this.lines,
version: this.version,
ranges: this.ranges,
pathname: this.pathname,
projectHistoryId: this.projectHistoryId,
historyRangesSupport: false,
type: 'sharejs-text-ot',
})
this.RangesManager.applyUpdate.returns({
newRanges: this.updated_ranges,
rangesWereCollapsed: false,
historyUpdates: this.historyUpdates,
removedChangeIds: this.removedChangeIds,
removedChangeIds: ['change-1', 'change-2'],
})
await this.UpdateManager.promises.applyUpdate(
this.project_id,
@@ -554,7 +582,7 @@ describe('UpdateManager', function () {
this.WebApiManager.promises.notifyTrackChangesRejected.should.have.been.calledWith(
this.project_id,
this.doc_id,
this.removedChangeIds,
this.rejectedChangeAuthorIds,
this.updateMeta.user_id
)
})