Skip to content

Commit

Permalink
fix(annotation): improve test to add contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaju committed Sep 10, 2020
1 parent 01a0c37 commit e9841d4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/js/entities/annotationsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ AnnotationsManager.prototype = {
motivations = 'oa:identifying';
}

console.log(entity);

// USER
const userInfo = this.w.getUserInfo();

Expand Down Expand Up @@ -213,8 +211,14 @@ AnnotationsManager.prototype = {
//contributors
if (entity.didUpdate) {

//add contributor if current user IS NOT the creator and one of the contributors
const userIsCreator = userInfo.id === entity.creator['@id'];
//add contributor if current user IS NEITHER the creator NOR one of the contributors
let userIsCreator = false
if (entity?.creator?.['@id']) {
userIsCreator = userInfo.id === entity?.creator?.['@id']
} else {
userIsCreator = userInfo.id === creator['@id']
}

let userIsContributor = false;
if (annotation['dcterms:contributor']) {
userIsContributor = annotation['dcterms:contributor'].find(
Expand Down

0 comments on commit e9841d4

Please sign in to comment.