item deletion
This commit is contained in:
@@ -46,10 +46,12 @@ class Item {
|
||||
addReference(reference) {
|
||||
this.content.references.push(reference);
|
||||
this.content.references = _.uniq(this.content.references);
|
||||
this.updateReferencesLocalMapping();
|
||||
}
|
||||
|
||||
removeReference(reference) {
|
||||
_.remove(this.content.references, _.find(this.content.references, {uuid: reference.uuid}));
|
||||
this.updateReferencesLocalMapping();
|
||||
}
|
||||
|
||||
referencesMatchingContentType(contentType) {
|
||||
@@ -62,7 +64,6 @@ class Item {
|
||||
// should be overriden to manage local properties
|
||||
}
|
||||
|
||||
/* Returns true if note is shared individually or via tag */
|
||||
isPublic() {
|
||||
return this.presentation;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ class Note extends Item {
|
||||
return filtered;
|
||||
}
|
||||
|
||||
updateReferencesLocalMapping() {
|
||||
super.updateReferencesLocalMapping();
|
||||
this.tags = this.referencesMatchingContentType("Tag");
|
||||
}
|
||||
|
||||
get hasOnePublicTag() {
|
||||
var hasPublicTag = false;
|
||||
this.tags.forEach(function(tag){
|
||||
@@ -30,6 +35,10 @@ class Note extends Item {
|
||||
return hasPublicTag;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {uuid: this.uuid}
|
||||
}
|
||||
|
||||
isPublic() {
|
||||
return super.isPublic() || this.hasOnePublicTag;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,5 @@ class Tag extends Item {
|
||||
updateReferencesLocalMapping() {
|
||||
super.updateReferencesLocalMapping();
|
||||
this.notes = this.referencesMatchingContentType("Note");
|
||||
console.log("notes after maping", this.notes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user