only accept relevant items

This commit is contained in:
Mo Bitar
2017-02-10 14:13:45 -06:00
parent fe89fa8c3b
commit 296f77df6f
3 changed files with 9 additions and 4 deletions

View File

@@ -71,7 +71,7 @@ class AccountMenu {
}
$scope.newPasswordData.status = "Successfully changed password and re-encrypted all items.";
$timeout(function(){
alert("Your password has been changed, and your items successfully re-encrypted and synced. You must sign out on all other signed in applications and sign in again, or else you may corrupt your data.")
alert("Your password has been changed, and your items successfully re-encrypted and synced. You must sign out of all other signed in applications and sign in again, or else you may corrupt your data.")
$scope.newPasswordData = {};
}, 1000)
});

View File

@@ -8,6 +8,7 @@ class ModelManager {
this.itemChangeObservers = [];
this.items = [];
this._extensions = [];
this.acceptableContentTypes = ["Note", "Tag", "Extension"];
}
get allItems() {
@@ -62,7 +63,7 @@ class ModelManager {
for (var json_obj of items) {
json_obj = _.omit(json_obj, omitFields || [])
var item = this.findItem(json_obj["uuid"]);
if(json_obj["deleted"] == true) {
if(json_obj["deleted"] == true || !_.includes(this.acceptableContentTypes, json_obj["content_type"])) {
if(item) {
this.removeItemLocally(item)
}
@@ -227,7 +228,11 @@ class ModelManager {
/* Used when changing encryption key */
setAllItemsDirty() {
for(var item of this.allItems) {
var relevantItems = this.allItems.filter(function(item){
return _.includes(this.acceptableContentTypes, item.content_type);
}.bind(this));
for(var item of relevantItems) {
item.setDirty(true);
}
}