Fixes altnernate uuids on sign in to notify observers, fixes dummy note becoming undummy

This commit is contained in:
Mo Bitar
2018-01-12 16:38:26 -06:00
parent c7ce308a19
commit a679f82859
8 changed files with 27 additions and 25 deletions

View File

@@ -245,7 +245,6 @@ angular.module('app.frontend')
this.onNameBlur = function() {
this.editingName = false;
this.updateTagsFromTagsString()
}
this.toggleFullScreen = function() {

View File

@@ -115,8 +115,8 @@ angular.module('app.frontend')
this.rooms = [];
modelManager.addItemSyncObserver("room-bar", "SN|Component", (allItems, validItems, deletedItems, source) => {
this.rooms = _.uniq(this.rooms.concat(allItems.filter((candidate) => {return candidate.area == "rooms"})))
.filter((candidate) => {return !candidate.deleted});
var incomingRooms = allItems.filter((candidate) => {return candidate.area == "rooms"});
this.rooms = _.uniq(this.rooms.concat(incomingRooms)).filter((candidate) => {return !candidate.deleted});
});
componentManager.registerHandler({identifier: "roomBar", areas: ["rooms"], activationHandler: (component) => {
@@ -161,9 +161,7 @@ angular.module('app.frontend')
// Handle singleton ProLink instance
singletonManager.registerSingleton({content_type: "SN|Component", package_info: {identifier: "org.standardnotes.prolink"}}, (resolvedSingleton) => {
}, (valueCallback) => {
// Safe to create. Create and return object.
let url = window._prolink_package_url;
console.log("Installing ProLink from URL", url);

View File

@@ -62,9 +62,10 @@ class ModelManager {
}
if(removeOriginal) {
this.removeItemLocally(item, function(){
block();
});
// Set to deleted, then run through mapping function so that observers can be notified
item.deleted = true;
this.mapResponseItemsToLocalModels([item], ModelManager.MappingSourceLocalSaved);
block();
} else {
block();
}
@@ -81,13 +82,13 @@ class ModelManager {
}
allItemsMatchingTypes(contentTypes) {
return this.items.filter(function(item){
return this.allItems.filter(function(item){
return (_.includes(contentTypes, item.content_type) || _.includes(contentTypes, "*")) && !item.dummy;
})
}
itemsForContentType(contentType) {
return this.items.filter(function(item){
return this.allItems.filter(function(item){
return item.content_type == contentType;
});
}

View File

@@ -24,10 +24,10 @@ class SingletonManager {
})
// Testing code to make sure only 1 exists
setTimeout(function () {
var userPrefs = modelManager.itemsForContentType("SN|UserPreferences");
console.assert(userPrefs.length == 1);
}, 1000);
// setTimeout(function () {
// var userPrefs = modelManager.itemsForContentType("SN|UserPreferences");
// console.assert(userPrefs.length == 1);
// }, 1000);
}
registerSingleton(predicate, resolveCallback, createBlock) {

View File

@@ -84,6 +84,8 @@ class SyncManager {
// use a copy, as alternating uuid will affect array
var originalItems = this.modelManager.allItems.slice();
console.log("markAllItemsDirtyAndSaveOffline", originalItems);
var block = () => {
var allItems = this.modelManager.allItems;
for(var item of allItems) {
@@ -97,7 +99,7 @@ class SyncManager {
let alternateNextItem = () => {
if(index >= originalItems.length) {
// We don't use originalItems as altnerating UUID will have deleted them.
// We don't use originalItems as alternating UUID will have deleted them.
block();
return;
}

View File

@@ -7,11 +7,13 @@
.panel-section.hero{"ng-if" => "!user && !formData.showLogin && !formData.showRegister && !formData.mfa"}
%h1.title Sign in or register to enable sync and end-to-end encryption.
.button-group.stretch
.button.info.featured{"ng-click" => "formData.showLogin = true"}
.label Sign In
.button.info.featured{"ng-click" => "formData.showRegister = true"}
.label Register
.panel-row
.panel-row
.button-group.stretch
.button.info.featured{"ng-click" => "formData.showLogin = true"}
.label Sign In
.button.info.featured{"ng-click" => "formData.showRegister = true"}
.label Register
%p
Standard Notes is free on every platform, and comes standard with sync and encryption.
@@ -30,9 +32,9 @@
%h2.title No Password Reset.
.text Because your notes are encrypted using your password, Standard Notes does not have a password reset option. You cannot forget your password.
.advanced-options.panel-row{"ng-if" => "formData.showAdvanced"}
.float-group
.panel-column
%label.pull-left Sync Server Domain
%input.form-control.mt-5{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'formData.url'}
%input.form-control.mt-5{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'formData.url'}
.button-group.stretch.panel-row.form-submit
.button.info.featured{"ng-click" => "submitAuthForm()"}
@@ -41,7 +43,7 @@
%label
%input{"type" => "checkbox", "ng-model" => "formData.ephemeral", "ng-true-value" => "false", "ng-false-value" => "true"}
Stay signed in
%label
%label{"ng-if" => "notesAndTagsCount() > 0"}
%input{"type" => "checkbox", "ng-model" => "formData.mergeLocal", "ng-bind" => "true", "ng-change" => "mergeLocalChanged()"}
Merge local data ({{notesAndTagsCount()}} notes and tags)

View File

@@ -19,7 +19,7 @@
.item.border
.item{"ng-repeat" => "room in ctrl.rooms"}
.item{"ng-repeat" => "room in ctrl.rooms track by room.uuid"}
.column{"ng-click" => "ctrl.selectRoom(room)"}
.label {{room.name}}
%component-modal{"ng-if" => "room.showRoom", "component" => "room", "controller" => "room.directiveController"}

View File

@@ -1,5 +1,5 @@
{
"name": "neeto",
"name": "standard-notes",
"version": "1.0.0",
"repository": {
"type": "git",