diff --git a/src/lib/annotations/Annotation.js b/src/lib/annotations/Annotation.js index 1c64a22ee..f7983fe46 100644 --- a/src/lib/annotations/Annotation.js +++ b/src/lib/annotations/Annotation.js @@ -37,7 +37,7 @@ class Annotation { this.annotationID = data.annotationID; this.fileVersionId = data.fileVersionId; this.threadID = data.threadID; - this.thread = data.thread; + this.threadNumber = data.threadNumber; this.type = data.type; this.text = data.text; this.location = data.location; diff --git a/src/lib/annotations/AnnotationDialog.js b/src/lib/annotations/AnnotationDialog.js index 9710b76ab..e4b689325 100644 --- a/src/lib/annotations/AnnotationDialog.js +++ b/src/lib/annotations/AnnotationDialog.js @@ -280,7 +280,7 @@ class AnnotationDialog extends EventEmitter { // Adding thread number to dialog if (annotations.length > 0) { - this.element.dataset.threadNumber = annotations[0].thread; + this.element.dataset.threadNumber = annotations[0].threadNumber; } this.bindDOMListeners(); diff --git a/src/lib/annotations/AnnotationService.js b/src/lib/annotations/AnnotationService.js index 25de39974..a537b1dbc 100644 --- a/src/lib/annotations/AnnotationService.js +++ b/src/lib/annotations/AnnotationService.js @@ -86,7 +86,7 @@ class AnnotationService extends EventEmitter { threadID: annotation.threadID }, message: annotation.text, - thread: annotation.thread + threadNumber: annotation.threadNumber }) }) .then((response) => response.json()) @@ -227,7 +227,7 @@ class AnnotationService extends EventEmitter { fileVersionId: data.item.id, threadID: data.details.threadID, type: data.details.type, - thread: data.thread, + threadNumber: data.thread, text: data.message, location: data.details.location, user: { diff --git a/src/lib/annotations/AnnotationThread.js b/src/lib/annotations/AnnotationThread.js index 6b8d5375d..4a1e0d04c 100644 --- a/src/lib/annotations/AnnotationThread.js +++ b/src/lib/annotations/AnnotationThread.js @@ -46,7 +46,7 @@ class AnnotationThread extends EventEmitter { this.fileVersionId = data.fileVersionId; this.location = data.location; this.threadID = data.threadID || AnnotationService.generateID(); - this.thread = data.thread || ''; + this.threadNumber = data.threadNumber || ''; this.type = data.type; this.locale = data.locale; this.isMobile = data.isMobile; @@ -158,8 +158,8 @@ class AnnotationThread extends EventEmitter { } // Add thread number to associated dialog and thread - this.thread = this.thread || savedAnnotation.thread; - this.dialog.element.dataset.threadNumber = this.thread; + this.threadNumber = this.threadNumber || savedAnnotation.threadNumber; + this.dialog.element.dataset.threadNumber = this.threadNumber; // Otherwise, replace temporary annotation with annotation saved to server this.annotations[tempIdx] = savedAnnotation; @@ -454,7 +454,7 @@ class AnnotationThread extends EventEmitter { location: this.location, user: this.annotationService.user, threadID: this.threadID, - thread: this.thread + threadNumber: this.threadNumber }; } diff --git a/src/lib/annotations/__tests__/AnnotationDialog-test.js b/src/lib/annotations/__tests__/AnnotationDialog-test.js index e032bf93a..42d0586c0 100644 --- a/src/lib/annotations/__tests__/AnnotationDialog-test.js +++ b/src/lib/annotations/__tests__/AnnotationDialog-test.js @@ -299,7 +299,7 @@ describe('lib/annotations/AnnotationDialog', () => { text: 'blah', user: {}, permissions: {}, - thread: 1 + threadNumber: 1 }); dialog.isMobile = false; diff --git a/src/lib/annotations/__tests__/AnnotationService-test.js b/src/lib/annotations/__tests__/AnnotationService-test.js index 39946bd76..4bab59f92 100644 --- a/src/lib/annotations/__tests__/AnnotationService-test.js +++ b/src/lib/annotations/__tests__/AnnotationService-test.js @@ -42,7 +42,7 @@ describe('lib/annotations/AnnotationService', () => { fileVersionId: 2, threadID: AnnotationService.generateID(), type: 'point', - thread: '1', + threadNumber: '1', text: 'blah', location: { x: 0, y: 0 } }); @@ -60,7 +60,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: annotationToSave.threadID, location: annotationToSave.location }, - thread: annotationToSave.thread, + thread: annotationToSave.threadNumber, message: annotationToSave.text, created_by: {} } @@ -70,7 +70,7 @@ describe('lib/annotations/AnnotationService', () => { return annotationService.create(annotationToSave).then((createdAnnotation) => { expect(createdAnnotation.fileVersionId).to.equal(annotationToSave.fileVersionId); expect(createdAnnotation.threadID).to.equal(annotationToSave.threadID); - expect(createdAnnotation.thread).to.equal(annotationToSave.thread); + expect(createdAnnotation.threadNumber).to.equal(annotationToSave.threadNumber); expect(createdAnnotation.type).to.equal(annotationToSave.type); expect(createdAnnotation.text).to.equal(annotationToSave.text); expect(createdAnnotation.location.x).to.equal(annotationToSave.location.x); @@ -110,7 +110,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 } }); @@ -119,7 +119,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'highlight', text: 'blah2', - thread: '2', + threadNumber: '2', location: { x: 0, y: 0 } }); @@ -137,7 +137,7 @@ describe('lib/annotations/AnnotationService', () => { location: annotation1.location }, message: annotation1.text, - thread: annotation1.thread, + thread: annotation1.threadNumber, created_by: {} }, { @@ -151,7 +151,7 @@ describe('lib/annotations/AnnotationService', () => { location: annotation2.location }, message: annotation2.text, - thread: annotation2.thread, + threadNumber: annotation2.threadNumber, created_by: {} } ] @@ -228,7 +228,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 } }); @@ -237,7 +237,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'point', text: 'blah2', - thread: '2', + threadNumber: '2', location: { x: 0, y: 0 } }); @@ -246,7 +246,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: annotation1.threadID, type: 'point', text: 'blah3', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 } }); @@ -255,8 +255,8 @@ describe('lib/annotations/AnnotationService', () => { return annotationService.getThreadMap(2).then((threadMap) => { expect(threadMap[annotation1.threadID].length).to.equal(2); expect(threadMap[annotation2.threadID][0]).to.contain(annotation2); - expect(threadMap[annotation1.threadID][0].thread).to.equal(threadMap[annotation1.threadID][1].thread); - expect(threadMap[annotation1.threadID][0].thread).to.not.equal( + expect(threadMap[annotation1.threadID][0].threadNumber).to.equal(threadMap[annotation1.threadID][1].threadNumber); + expect(threadMap[annotation1.threadID][0].threadNumber).to.not.equal( threadMap[annotation2.threadID][0].thread ); }); @@ -273,7 +273,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: '2016-10-29T14:19:56' }); @@ -284,7 +284,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: annotation1.threadID, type: 'point', text: 'blah4', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: '2016-10-30T14:19:56' }); @@ -294,7 +294,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'point', text: 'blah2', - thread: '2', + threadNumber: '2', location: { x: 0, y: 0 }, created: '2016-10-30T14:19:56' }); @@ -304,7 +304,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: annotation1.threadID, type: 'point', text: 'blah3', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: '2016-10-31T14:19:56' }); @@ -314,8 +314,8 @@ describe('lib/annotations/AnnotationService', () => { expect(threadMap[annotation1.threadID].length).to.equal(3); expect(threadMap[annotation1.threadID][0]).to.equal(annotation1); expect(threadMap[annotation1.threadID][1]).to.equal(annotation4); - expect(threadMap[annotation1.threadID][0].thread).to.equal(threadMap[annotation1.threadID][1].thread); - expect(threadMap[annotation1.threadID][0].thread).to.not.equal(threadMap[annotation2.threadID][0].thread); + expect(threadMap[annotation1.threadID][0].threadNumber).to.equal(threadMap[annotation1.threadID][1].threadNumber); + expect(threadMap[annotation1.threadID][0].threadNumber).to.not.equal(threadMap[annotation2.threadID][0].threadNumber); }); }); @@ -326,7 +326,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: 1, type: 'point', text: 'blah3', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: Date.now(), item: { id: 1 }, @@ -348,7 +348,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: AnnotationService.generateID(), type: 'highlight', text: 'blah2', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 } }); @@ -365,7 +365,7 @@ describe('lib/annotations/AnnotationService', () => { threadID: annotation2.threadID, location: annotation2.location }, - thread: annotation2.thread, + thread: annotation2.threadNumber, message: annotation2.text, created_by: {} } @@ -385,7 +385,7 @@ describe('lib/annotations/AnnotationService', () => { promise.then((result) => { expect(result.length).to.equal(1); expect(result[0].text).to.equal(annotation2.text); - expect(result[0].thread).to.equal(annotation2.thread); + expect(result[0].threadNumber).to.equal(annotation2.threadNumber); }); }); diff --git a/src/lib/annotations/__tests__/AnnotationThread-test.js b/src/lib/annotations/__tests__/AnnotationThread-test.js index 8ff93f182..2235e33ee 100644 --- a/src/lib/annotations/__tests__/AnnotationThread-test.js +++ b/src/lib/annotations/__tests__/AnnotationThread-test.js @@ -30,7 +30,7 @@ describe('lib/annotations/AnnotationThread', () => { isMobile: false, location: {}, threadID: '2', - thread: '1', + threadNumber: '1', type: 'point' }); @@ -137,7 +137,7 @@ describe('lib/annotations/AnnotationThread', () => { fileVersionId: '1', location: {}, threadID: '2', - thread: '1', + threadNumber: '1', type: 'point' }); @@ -154,7 +154,7 @@ describe('lib/annotations/AnnotationThread', () => { type: 'point', text: 'blah', threadID: '2', - thread: '1' + threadNumber: '1' }) ); expect(thread.state).to.equal(STATES.hover); @@ -204,7 +204,7 @@ describe('lib/annotations/AnnotationThread', () => { isMobile: false, location: {}, threadID: '2', - thread: '1', + threadNumber: '1', type: 'point' }); @@ -356,7 +356,7 @@ describe('lib/annotations/AnnotationThread', () => { isMobile: false, location: {}, threadID: '2', - thread: '1', + threadNumber: '1', type: 'point' }); @@ -508,7 +508,7 @@ describe('lib/annotations/AnnotationThread', () => { threadID: '1', type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: Date.now() }); @@ -528,7 +528,7 @@ describe('lib/annotations/AnnotationThread', () => { threadID: '1', type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: Date.now() }); @@ -545,7 +545,7 @@ describe('lib/annotations/AnnotationThread', () => { threadID: '1', type: 'point', text: 'blah', - thread: '1', + threadNumber: '1', location: { x: 0, y: 0 }, created: Date.now() }); diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 246c8e0d8..48b1af506 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -285,7 +285,7 @@ class DocAnnotator extends Annotator { // Set existing thread ID if created with annotations if (annotations.length > 0) { threadParams.threadID = annotations[0].threadID; - threadParams.thread = annotations[0].thread; + threadParams.threadNumber = annotations[0].threadNumber; } if (!annotatorUtil.validateThreadParams(threadParams)) { diff --git a/src/lib/annotations/doc/DocHighlightDialog.js b/src/lib/annotations/doc/DocHighlightDialog.js index 87b23e48e..1adc60cf4 100644 --- a/src/lib/annotations/doc/DocHighlightDialog.js +++ b/src/lib/annotations/doc/DocHighlightDialog.js @@ -230,7 +230,7 @@ class DocHighlightDialog extends AnnotationDialog { // Adding thread number to dialog if (annotations.length > 0) { - this.element.dataset.threadNumber = annotations[0].thread; + this.element.dataset.threadNumber = annotations[0].threadNumber; } } diff --git a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js index aaaa2bdea..bab1feca7 100644 --- a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js +++ b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js @@ -259,7 +259,7 @@ describe('lib/annotations/doc/DocAnnotator', () => { fileVersionId: 2, threadID: '1', type: TYPES.point, - thread: '1', + threadNumber: '1', text: 'blah', location: { x: 0, y: 0 } }); @@ -267,7 +267,7 @@ describe('lib/annotations/doc/DocAnnotator', () => { expect(stubs.addThread).to.have.been.called; expect(thread.threadID).to.equal(annotation.threadID); - expect(thread.thread).to.equal(annotation.thread); + expect(thread.threadNumber).to.equal(annotation.threadNumber); expect(thread instanceof DocHighlightThread).to.be.true; expect(annotator.handleValidationError).to.not.be.called; }); diff --git a/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js b/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js index e4ad32934..c0c99b036 100644 --- a/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js +++ b/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js @@ -218,7 +218,7 @@ describe('lib/annotations/doc/DocHighlightDialog', () => { permissions: { can_delete: true }, - thread: 1 + threadNumber: 1 }); stubs.show = sandbox.stub(annotatorUtil, 'showElement'); stubs.hide = sandbox.stub(annotatorUtil, 'hideElement'); @@ -255,7 +255,7 @@ describe('lib/annotations/doc/DocHighlightDialog', () => { permissions: { can_delete: true }, - thread: 1 + threadNumber: 1 }); dialog.setup([annotation]); diff --git a/src/lib/annotations/drawing/DrawingThread.js b/src/lib/annotations/drawing/DrawingThread.js index 87d3ae21f..bff922f06 100644 --- a/src/lib/annotations/drawing/DrawingThread.js +++ b/src/lib/annotations/drawing/DrawingThread.js @@ -167,7 +167,7 @@ class DrawingThread extends AnnotationThread { fileVersionId: this.fileVersionId, user: this.annotationService.user, threadID: this.threadID, - thread: this.thread + threadNumber: this.threadNumber }; } }