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 // must override
this.setDirty(true); this.setDirty(true);
} }

View File

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

View File

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

View File

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

View File

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