|
|
@@ -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
|
|
|
)
|
|
|
})
|