mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #18309 from overleaf/mj-add-comment-resolved
[overleaf-editor-core] Omit resolved: false for comments serialisation GitOrigin-RevId: 909f20efd8f3c3e50d40e09366951d317a4c31bf
This commit is contained in:
parent
6680bedf6c
commit
655f9b50ae
13 changed files with 55 additions and 93 deletions
|
@ -149,11 +149,14 @@ class Comment {
|
||||||
* @returns {CommentRawData}
|
* @returns {CommentRawData}
|
||||||
*/
|
*/
|
||||||
toRaw() {
|
toRaw() {
|
||||||
return {
|
const raw = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
resolved: this.resolved,
|
|
||||||
ranges: this.ranges.map(range => range.toRaw()),
|
ranges: this.ranges.map(range => range.toRaw()),
|
||||||
}
|
}
|
||||||
|
if (this.resolved) {
|
||||||
|
raw.resolved = true
|
||||||
|
}
|
||||||
|
return raw
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,11 +38,14 @@ class AddCommentOperation extends EditOperation {
|
||||||
* @returns {RawAddCommentOperation}
|
* @returns {RawAddCommentOperation}
|
||||||
*/
|
*/
|
||||||
toJSON() {
|
toJSON() {
|
||||||
return {
|
const raw = {
|
||||||
commentId: this.commentId,
|
commentId: this.commentId,
|
||||||
ranges: this.ranges.map(range => range.toRaw()),
|
ranges: this.ranges.map(range => range.toRaw()),
|
||||||
resolved: this.resolved,
|
|
||||||
}
|
}
|
||||||
|
if (this.resolved) {
|
||||||
|
raw.resolved = true
|
||||||
|
}
|
||||||
|
return raw
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,6 @@ describe('AddCommentOperation', function () {
|
||||||
const op = new AddCommentOperation('123', [new Range(0, 1)])
|
const op = new AddCommentOperation('123', [new Range(0, 1)])
|
||||||
expect(op.toJSON()).to.eql({
|
expect(op.toJSON()).to.eql({
|
||||||
commentId: '123',
|
commentId: '123',
|
||||||
resolved: false,
|
|
||||||
ranges: [
|
ranges: [
|
||||||
{
|
{
|
||||||
pos: 0,
|
pos: 0,
|
||||||
|
@ -39,7 +38,6 @@ describe('AddCommentOperation', function () {
|
||||||
{
|
{
|
||||||
id: '123',
|
id: '123',
|
||||||
ranges: [{ pos: 0, length: 1 }],
|
ranges: [{ pos: 0, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -54,10 +52,8 @@ describe('AddCommentOperation', function () {
|
||||||
{
|
{
|
||||||
id: '123',
|
id: '123',
|
||||||
ranges: [{ pos: 0, length: 1 }],
|
ranges: [{ pos: 0, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const invertedOp = op.invert(initialFileData)
|
const invertedOp = op.invert(initialFileData)
|
||||||
invertedOp.apply(fileData)
|
invertedOp.apply(fileData)
|
||||||
expect(fileData.getComments().toRaw()).to.eql([])
|
expect(fileData.getComments().toRaw()).to.eql([])
|
||||||
|
@ -68,7 +64,6 @@ describe('AddCommentOperation', function () {
|
||||||
{
|
{
|
||||||
id: '123',
|
id: '123',
|
||||||
ranges: [{ pos: 0, length: 1 }],
|
ranges: [{ pos: 0, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -97,7 +92,6 @@ describe('AddCommentOperation', function () {
|
||||||
{
|
{
|
||||||
id: '123',
|
id: '123',
|
||||||
ranges: [{ pos: 0, length: 1 }],
|
ranges: [{ pos: 0, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,11 @@ describe('commentList', function () {
|
||||||
])
|
])
|
||||||
|
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
{
|
{
|
||||||
id: 'comm3',
|
id: 'comm3',
|
||||||
ranges: [{ pos: 30, length: 15 }],
|
ranges: [{ pos: 30, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -41,7 +40,6 @@ describe('commentList', function () {
|
||||||
length: 5,
|
length: 5,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -54,17 +52,15 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.add(new Comment('comm4', [new Range(40, 10)]))
|
commentList.add(new Comment('comm4', [new Range(40, 10)]))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
{
|
{
|
||||||
id: 'comm3',
|
id: 'comm3',
|
||||||
ranges: [{ pos: 30, length: 15 }],
|
ranges: [{ pos: 30, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'comm4',
|
id: 'comm4',
|
||||||
ranges: [{ pos: 40, length: 10 }],
|
ranges: [{ pos: 40, length: 10 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -89,7 +85,6 @@ describe('commentList', function () {
|
||||||
{
|
{
|
||||||
id: 'comm3',
|
id: 'comm3',
|
||||||
ranges: [{ pos: 30, length: 15 }],
|
ranges: [{ pos: 30, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -103,8 +98,8 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.delete('comm3')
|
commentList.delete('comm3')
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -118,12 +113,11 @@ describe('commentList', function () {
|
||||||
commentList.delete('comm5')
|
commentList.delete('comm5')
|
||||||
|
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
{
|
{
|
||||||
id: 'comm3',
|
id: 'comm3',
|
||||||
ranges: [{ pos: 30, length: 15 }],
|
ranges: [{ pos: 30, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
@ -149,8 +143,8 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyInsert(new Range(15, 5), { commentIds: ['comm1'] })
|
commentList.applyInsert(new Range(15, 5), { commentIds: ['comm1'] })
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 15 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 15 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 10 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 10 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -168,8 +162,8 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyInsert(new Range(15, 5), { commentIds: ['comm2'] })
|
commentList.applyInsert(new Range(15, 5), { commentIds: ['comm2'] })
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 15, length: 15 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 15, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -188,8 +182,8 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyDelete(new Range(10, 10)) // 10-19
|
commentList.applyDelete(new Range(10, 10)) // 10-19
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 5 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 5 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 10, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 10, length: 5 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -212,9 +206,9 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyInsert(new Range(7, 5), { commentIds: ['comm1'] })
|
commentList.applyInsert(new Range(7, 5), { commentIds: ['comm1'] })
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 15 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 15 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 25, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 25, length: 5 }] },
|
||||||
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -242,7 +236,6 @@ describe('commentList', function () {
|
||||||
{ pos: 5, length: 2 },
|
{ pos: 5, length: 2 },
|
||||||
{ pos: 12, length: 8 },
|
{ pos: 12, length: 8 },
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'comm2',
|
id: 'comm2',
|
||||||
|
@ -250,9 +243,8 @@ describe('commentList', function () {
|
||||||
{ pos: 7, length: 5 },
|
{ pos: 7, length: 5 },
|
||||||
{ pos: 25, length: 5 },
|
{ pos: 25, length: 5 },
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -279,7 +271,6 @@ describe('commentList', function () {
|
||||||
{
|
{
|
||||||
id: 'comm1',
|
id: 'comm1',
|
||||||
ranges: [{ pos: 5, length: 20 }],
|
ranges: [{ pos: 5, length: 20 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'comm2',
|
id: 'comm2',
|
||||||
|
@ -287,9 +278,8 @@ describe('commentList', function () {
|
||||||
{ pos: 7, length: 5 },
|
{ pos: 7, length: 5 },
|
||||||
{ pos: 25, length: 5 },
|
{ pos: 25, length: 5 },
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -311,9 +301,9 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyInsert(new Range(16, 5))
|
commentList.applyInsert(new Range(16, 5))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 25, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 25, length: 5 }] },
|
||||||
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 35, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -335,9 +325,9 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyInsert(new Range(50, 5))
|
commentList.applyInsert(new Range(50, 5))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
{ id: 'comm3', ranges: [{ pos: 30, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 30, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -359,9 +349,9 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyDelete(new Range(0, 4))
|
commentList.applyDelete(new Range(0, 4))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 1, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 1, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 16, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 16, length: 5 }] },
|
||||||
{ id: 'comm3', ranges: [{ pos: 26, length: 15 }], resolved: false },
|
{ id: 'comm3', ranges: [{ pos: 26, length: 15 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -376,7 +366,7 @@ describe('commentList', function () {
|
||||||
|
|
||||||
commentList.applyDelete(new Range(0, 6))
|
commentList.applyDelete(new Range(0, 6))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 0, length: 9 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 0, length: 9 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -389,7 +379,7 @@ describe('commentList', function () {
|
||||||
])
|
])
|
||||||
commentList.applyDelete(new Range(7, 10))
|
commentList.applyDelete(new Range(7, 10))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 2 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 2 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -402,7 +392,7 @@ describe('commentList', function () {
|
||||||
])
|
])
|
||||||
commentList.applyDelete(new Range(6, 2))
|
commentList.applyDelete(new Range(6, 2))
|
||||||
expect(commentList.toRaw()).to.eql([
|
expect(commentList.toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 8 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 8 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -428,13 +418,11 @@ describe('commentList', function () {
|
||||||
{
|
{
|
||||||
id: 'comm1',
|
id: 'comm1',
|
||||||
ranges: [{ pos: 5, length: 10 }],
|
ranges: [{ pos: 5, length: 10 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{ id: 'comm2', ranges: [], resolved: false },
|
{ id: 'comm2', ranges: [] },
|
||||||
{
|
{
|
||||||
id: 'comm3',
|
id: 'comm3',
|
||||||
ranges: [{ pos: 20, length: 15 }],
|
ranges: [{ pos: 20, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
|
@ -104,7 +104,6 @@ describe('EditOperationTransformer', function () {
|
||||||
expect(bPrime.toJSON()).to.eql({
|
expect(bPrime.toJSON()).to.eql({
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [{ pos: 16, length: 3 }],
|
ranges: [{ pos: 16, length: 3 }],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -122,7 +121,6 @@ describe('EditOperationTransformer', function () {
|
||||||
expect(aPrime.toJSON()).to.eql({
|
expect(aPrime.toJSON()).to.eql({
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [{ pos: 16, length: 3 }],
|
ranges: [{ pos: 16, length: 3 }],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -140,7 +138,6 @@ describe('EditOperationTransformer', function () {
|
||||||
expect(bPrime.toJSON()).to.eql({
|
expect(bPrime.toJSON()).to.eql({
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [],
|
ranges: [],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -159,7 +156,6 @@ describe('EditOperationTransformer', function () {
|
||||||
expect(bPrime.toJSON()).to.eql({
|
expect(bPrime.toJSON()).to.eql({
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [{ pos: 8, length: 1 }],
|
ranges: [{ pos: 8, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -178,7 +174,6 @@ describe('EditOperationTransformer', function () {
|
||||||
expect(bPrime.toJSON()).to.eql({
|
expect(bPrime.toJSON()).to.eql({
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [{ pos: 12, length: 1 }],
|
ranges: [{ pos: 12, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -267,7 +262,6 @@ describe('EditOperationBuilder', function () {
|
||||||
const raw = {
|
const raw = {
|
||||||
commentId: 'comm1',
|
commentId: 'comm1',
|
||||||
ranges: [{ pos: 0, length: 1 }],
|
ranges: [{ pos: 0, length: 1 }],
|
||||||
resolved: false,
|
|
||||||
}
|
}
|
||||||
const op = EditOperationBuilder.fromJSON(raw)
|
const op = EditOperationBuilder.fromJSON(raw)
|
||||||
expect(op).to.be.an.instanceof(AddCommentOperation)
|
expect(op).to.be.an.instanceof(AddCommentOperation)
|
||||||
|
|
|
@ -87,7 +87,6 @@ describe('HashFileData', function () {
|
||||||
{
|
{
|
||||||
id: 'comment-1',
|
id: 'comment-1',
|
||||||
ranges: [{ pos: 1, length: 4 }],
|
ranges: [{ pos: 1, length: 4 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const fileData = new HashFileData(this.fileHash, this.rangesHash)
|
const fileData = new HashFileData(this.fileHash, this.rangesHash)
|
||||||
|
|
|
@ -26,9 +26,7 @@ describe('LazyStringFileData', function () {
|
||||||
.withArgs(this.fileHash)
|
.withArgs(this.fileHash)
|
||||||
.resolves('the quick brown fox')
|
.resolves('the quick brown fox')
|
||||||
this.blobStore.getObject.withArgs(this.rangesHash).resolves({
|
this.blobStore.getObject.withArgs(this.rangesHash).resolves({
|
||||||
comments: [
|
comments: [{ id: 'foo', ranges: [{ pos: 0, length: 3 }] }],
|
||||||
{ id: 'foo', ranges: [{ pos: 0, length: 3 }], resolved: false },
|
|
||||||
],
|
|
||||||
trackedChanges: [
|
trackedChanges: [
|
||||||
{
|
{
|
||||||
range: { pos: 4, length: 5 },
|
range: { pos: 4, length: 5 },
|
||||||
|
@ -121,7 +119,7 @@ describe('LazyStringFileData', function () {
|
||||||
expect(eagerString).to.be.instanceOf(EagerStringFileData)
|
expect(eagerString).to.be.instanceOf(EagerStringFileData)
|
||||||
expect(eagerString.getContent()).to.equal('the quick brown fox')
|
expect(eagerString.getContent()).to.equal('the quick brown fox')
|
||||||
expect(eagerString.getComments().toRaw()).to.deep.equal([
|
expect(eagerString.getComments().toRaw()).to.deep.equal([
|
||||||
{ id: 'foo', ranges: [{ pos: 0, length: 3 }], resolved: false },
|
{ id: 'foo', ranges: [{ pos: 0, length: 3 }] },
|
||||||
])
|
])
|
||||||
expect(eagerString.trackedChanges.toRaw()).to.deep.equal([
|
expect(eagerString.trackedChanges.toRaw()).to.deep.equal([
|
||||||
{
|
{
|
||||||
|
|
|
@ -819,7 +819,6 @@ describe('Operation', function () {
|
||||||
length: 1,
|
length: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -851,9 +850,7 @@ describe('Operation', function () {
|
||||||
foo: {
|
foo: {
|
||||||
content: 'xyz',
|
content: 'xyz',
|
||||||
metadata: {},
|
metadata: {},
|
||||||
comments: [
|
comments: [{ id: '1', ranges: [{ pos: 3, length: 1 }] }],
|
||||||
{ id: '1', ranges: [{ pos: 3, length: 1 }], resolved: false },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expectSymmetry()
|
.expectSymmetry()
|
||||||
|
@ -886,9 +883,7 @@ describe('Operation', function () {
|
||||||
foo: {
|
foo: {
|
||||||
content: 'xyz',
|
content: 'xyz',
|
||||||
metadata: {},
|
metadata: {},
|
||||||
comments: [
|
comments: [{ id: '1', ranges: [{ pos: 0, length: 4 }] }],
|
||||||
{ id: '1', ranges: [{ pos: 0, length: 4 }], resolved: false },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expectSymmetry()
|
.expectSymmetry()
|
||||||
|
@ -1070,9 +1065,7 @@ describe('Operation', function () {
|
||||||
foo: {
|
foo: {
|
||||||
content: 'xyz',
|
content: 'xyz',
|
||||||
metadata: {},
|
metadata: {},
|
||||||
comments: [
|
comments: [{ id: '1', ranges: [{ pos: 0, length: 3 }] }],
|
||||||
{ id: '1', ranges: [{ pos: 0, length: 3 }], resolved: false },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expectSymmetry()
|
.expectSymmetry()
|
||||||
|
|
|
@ -64,8 +64,8 @@ describe('StringFileData', function () {
|
||||||
])
|
])
|
||||||
|
|
||||||
expect(fileData.getComments().toRaw()).to.eql([
|
expect(fileData.getComments().toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: false },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }] },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ describe('StringFileData', function () {
|
||||||
length: 10,
|
length: 10,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'comm2',
|
id: 'comm2',
|
||||||
|
@ -97,7 +96,7 @@ describe('StringFileData', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(fileData.getComments().toRaw()).to.eql([
|
expect(fileData.getComments().toRaw()).to.eql([
|
||||||
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }], resolved: false },
|
{ id: 'comm1', ranges: [{ pos: 5, length: 10 }] },
|
||||||
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: true },
|
{ id: 'comm2', ranges: [{ pos: 20, length: 5 }], resolved: true },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
|
@ -369,7 +369,7 @@ describe('TextOperation', function () {
|
||||||
)
|
)
|
||||||
).to.deep.equal({
|
).to.deep.equal({
|
||||||
content: 'foo baz',
|
content: 'foo baz',
|
||||||
comments: [{ id: 'comment1', ranges: [], resolved: false }],
|
comments: [{ id: 'comment1', ranges: [] }],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -473,8 +473,8 @@ describe('TextOperation', function () {
|
||||||
).to.deep.equal({
|
).to.deep.equal({
|
||||||
content: 'foo baaar bbbaz',
|
content: 'foo baaar bbbaz',
|
||||||
comments: [
|
comments: [
|
||||||
{ id: 'comment1', ranges: [{ pos: 4, length: 5 }], resolved: false },
|
{ id: 'comment1', ranges: [{ pos: 4, length: 5 }] },
|
||||||
{ id: 'comment2', ranges: [{ pos: 10, length: 5 }], resolved: false },
|
{ id: 'comment2', ranges: [{ pos: 10, length: 5 }] },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -722,9 +722,7 @@ describe('TextOperation', function () {
|
||||||
)
|
)
|
||||||
).to.deep.equal({
|
).to.deep.equal({
|
||||||
content: 'foo qux baz',
|
content: 'foo qux baz',
|
||||||
comments: [
|
comments: [{ id: 'comment1', ranges: [{ pos: 4, length: 4 }] }],
|
||||||
{ id: 'comment1', ranges: [{ pos: 4, length: 4 }], resolved: false },
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -751,9 +749,7 @@ describe('TextOperation', function () {
|
||||||
)
|
)
|
||||||
).to.deep.equal({
|
).to.deep.equal({
|
||||||
content: 'foo qux corge bar baz',
|
content: 'foo qux corge bar baz',
|
||||||
comments: [
|
comments: [{ id: 'comment1', ranges: [{ pos: 4, length: 13 }] }],
|
||||||
{ id: 'comment1', ranges: [{ pos: 4, length: 13 }], resolved: false },
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ function olAddCommentOperation(doc, commentId, pos, length) {
|
||||||
pathname: doc.pathname.replace(/^\//, ''), // Strip leading /
|
pathname: doc.pathname.replace(/^\//, ''), // Strip leading /
|
||||||
commentId,
|
commentId,
|
||||||
ranges: [{ pos, length }],
|
ranges: [{ pos, length }],
|
||||||
resolved: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,6 @@ describe('Syncing with web and doc-updater', function () {
|
||||||
pathname: 'main.tex',
|
pathname: 'main.tex',
|
||||||
commentId,
|
commentId,
|
||||||
ranges: [{ pos: 1, length: 10 }],
|
ranges: [{ pos: 1, length: 10 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
origin: { kind: 'test-origin' },
|
origin: { kind: 'test-origin' },
|
||||||
|
|
|
@ -814,13 +814,11 @@ describe('UpdateTranslator', function () {
|
||||||
pathname: 'main.tex',
|
pathname: 'main.tex',
|
||||||
commentId: 'comment-id-1',
|
commentId: 'comment-id-1',
|
||||||
ranges: [{ pos: 5, length: 12 }],
|
ranges: [{ pos: 5, length: 12 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pathname: 'main.tex',
|
pathname: 'main.tex',
|
||||||
commentId: 'comment-id-2',
|
commentId: 'comment-id-2',
|
||||||
ranges: [{ pos: 7, length: 15 }],
|
ranges: [{ pos: 7, length: 15 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pathname: 'main.tex',
|
pathname: 'main.tex',
|
||||||
|
@ -999,7 +997,6 @@ describe('UpdateTranslator', function () {
|
||||||
pathname: 'main.tex',
|
pathname: 'main.tex',
|
||||||
commentId: 'comment-id',
|
commentId: 'comment-id',
|
||||||
ranges: [{ pos: 11, length: 14 }],
|
ranges: [{ pos: 11, length: 14 }],
|
||||||
resolved: false,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
v2Authors: [this.user_id],
|
v2Authors: [this.user_id],
|
||||||
|
|
Loading…
Reference in a new issue