Rename removeAllRelationships -> removeAndDirtyAllRelationships to be more explicit

This commit is contained in:
Mo Bitar
2017-11-04 19:52:13 -05:00
parent e547d344b7
commit 883d6525a8
5 changed files with 6 additions and 14 deletions

View File

@@ -117,7 +117,7 @@ class Item {
}
removeAllRelationships() {
removeAndDirtyAllRelationships() {
// must override
this.setDirty(true);
}

View File

@@ -56,8 +56,8 @@ class Editor extends Item {
super.removeItemAsRelationship(item);
}
removeAllRelationships() {
super.removeAllRelationships();
removeAndDirtyAllRelationships() {
super.removeAndDirtyAllRelationships();
this.notes = [];
}

View File

@@ -48,7 +48,7 @@ class Note extends Item {
super.removeItemAsRelationship(item);
}
removeAllRelationships() {
removeAndDirtyAllRelationships() {
this.tags.forEach(function(tag){
_.pull(tag.notes, this);
tag.setDirty(true);

View File

@@ -46,7 +46,7 @@ class Tag extends Item {
super.removeItemAsRelationship(item);
}
removeAllRelationships() {
removeAndDirtyAllRelationships() {
this.notes.forEach(function(note){
_.pull(note.tags, this);
note.setDirty(true);

View File

@@ -320,7 +320,7 @@ class ModelManager {
if(!item.dummy) {
item.setDirty(true);
}
item.removeAllRelationships();
item.removeAndDirtyAllRelationships();
}
/* Used when changing encryption key */
@@ -363,14 +363,6 @@ class ModelManager {
itemOne.setDirty(true);
itemTwo.setDirty(true);
}
removeRelationshipBetweenItems(itemOne, itemTwo) {
itemOne.removeItemAsRelationship(itemTwo);
itemTwo.removeItemAsRelationship(itemOne);
itemOne.setDirty(true);
itemTwo.setDirty(true);
}
}
angular.module('app.frontend').service('modelManager', ModelManager);