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.onNameBlur = function() {
this.editingName = false; this.editingName = false;
this.updateTagsFromTagsString()
} }
this.toggleFullScreen = function() { this.toggleFullScreen = function() {

View File

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

View File

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

View File

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

View File

@@ -84,6 +84,8 @@ class SyncManager {
// use a copy, as alternating uuid will affect array // use a copy, as alternating uuid will affect array
var originalItems = this.modelManager.allItems.slice(); var originalItems = this.modelManager.allItems.slice();
console.log("markAllItemsDirtyAndSaveOffline", originalItems);
var block = () => { var block = () => {
var allItems = this.modelManager.allItems; var allItems = this.modelManager.allItems;
for(var item of allItems) { for(var item of allItems) {
@@ -97,7 +99,7 @@ class SyncManager {
let alternateNextItem = () => { let alternateNextItem = () => {
if(index >= originalItems.length) { 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(); block();
return; return;
} }

View File

@@ -7,11 +7,13 @@
.panel-section.hero{"ng-if" => "!user && !formData.showLogin && !formData.showRegister && !formData.mfa"} .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. %h1.title Sign in or register to enable sync and end-to-end encryption.
.button-group.stretch .panel-row
.button.info.featured{"ng-click" => "formData.showLogin = true"} .panel-row
.label Sign In .button-group.stretch
.button.info.featured{"ng-click" => "formData.showRegister = true"} .button.info.featured{"ng-click" => "formData.showLogin = true"}
.label Register .label Sign In
.button.info.featured{"ng-click" => "formData.showRegister = true"}
.label Register
%p %p
Standard Notes is free on every platform, and comes standard with sync and encryption. Standard Notes is free on every platform, and comes standard with sync and encryption.
@@ -30,9 +32,9 @@
%h2.title No Password Reset. %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. .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"} .advanced-options.panel-row{"ng-if" => "formData.showAdvanced"}
.float-group .panel-column
%label.pull-left Sync Server Domain %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-group.stretch.panel-row.form-submit
.button.info.featured{"ng-click" => "submitAuthForm()"} .button.info.featured{"ng-click" => "submitAuthForm()"}
@@ -41,7 +43,7 @@
%label %label
%input{"type" => "checkbox", "ng-model" => "formData.ephemeral", "ng-true-value" => "false", "ng-false-value" => "true"} %input{"type" => "checkbox", "ng-model" => "formData.ephemeral", "ng-true-value" => "false", "ng-false-value" => "true"}
Stay signed in Stay signed in
%label %label{"ng-if" => "notesAndTagsCount() > 0"}
%input{"type" => "checkbox", "ng-model" => "formData.mergeLocal", "ng-bind" => "true", "ng-change" => "mergeLocalChanged()"} %input{"type" => "checkbox", "ng-model" => "formData.mergeLocal", "ng-bind" => "true", "ng-change" => "mergeLocalChanged()"}
Merge local data ({{notesAndTagsCount()}} notes and tags) Merge local data ({{notesAndTagsCount()}} notes and tags)

View File

@@ -19,7 +19,7 @@
.item.border .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)"} .column{"ng-click" => "ctrl.selectRoom(room)"}
.label {{room.name}} .label {{room.name}}
%component-modal{"ng-if" => "room.showRoom", "component" => "room", "controller" => "room.directiveController"} %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", "version": "1.0.0",
"repository": { "repository": {
"type": "git", "type": "git",