Skip to content

Commit

Permalink
Allow to specify new terms when reviewing annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
eburtin committed May 21, 2019
1 parent 858e7f8 commit 2fedca2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/models/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ export default class Annotation extends Model {
/**
* Create a reviewed annotation based on the current annotation
*
* @param {Array<Number>} terms The identifiers of the terms to associate to the annotation
*
* @returns {Annotation} The newly created reviewed annotation
*/
async review() {
async review(terms) {
if(this.isNew()) {
throw new Error('Cannot review an annotation with no ID.');
}

let {data} = await Cytomine.instance.api.put(`${this.callbackIdentifier}/${this.id}/review.json`);
let {data} = await Cytomine.instance.api.put(`${this.callbackIdentifier}/${this.id}/review.json`, {terms});
let reviewedAnnotation = new this.constructor(data['reviewedannotation']);
Cytomine.instance.lastCommand = data.command;
return reviewedAnnotation;
Expand Down

0 comments on commit 2fedca2

Please sign in to comment.