SFJS 0.3.60

This commit is contained in:
Mo Bitar
2019-05-28 14:09:29 -05:00
parent 8d4f86242a
commit 394958241b
7 changed files with 31 additions and 7709 deletions

View File

@@ -31,14 +31,6 @@ angular.module('app')
this.componentStack = []; this.componentStack = [];
this.isDesktop = isDesktopApplication(); this.isDesktop = isDesktopApplication();
$rootScope.$on("sync:taking-too-long", function(){
this.syncTakingTooLong = true;
}.bind(this));
$rootScope.$on("sync:completed", function(){
this.syncTakingTooLong = false;
}.bind(this));
const MinimumStatusDurationMs = 400; const MinimumStatusDurationMs = 400;
syncManager.addEventHandler((eventName, data) => { syncManager.addEventHandler((eventName, data) => {
@@ -46,7 +38,14 @@ angular.module('app')
return; return;
} }
if(eventName == "sync:completed") { if(eventName == "sync:taking-too-long") {
this.syncTakingTooLong = true;
}
else if(eventName == "sync:completed") {
this.syncTakingTooLong = false;
if(this.note.dirty) { if(this.note.dirty) {
// if we're still dirty, don't change status, a sync is likely upcoming. // if we're still dirty, don't change status, a sync is likely upcoming.
} else { } else {

View File

@@ -301,7 +301,7 @@ class AccountMenu {
if(item.content_type == "SN|Component") { item.active = false; } if(item.content_type == "SN|Component") { item.active = false; }
} }
syncManager.sync({additionalFields: ["created_at", "updated_at"]}).then((response) => { syncManager.sync().then((response) => {
// Response can be null if syncing offline // Response can be null if syncing offline
callback(response, errorCount); callback(response, errorCount);
}); });

View File

@@ -22,7 +22,9 @@
%form.sk-panel-form{"ng-submit" => "submitAuthForm()"} %form.sk-panel-form{"ng-submit" => "submitAuthForm()"}
.sk-panel-section .sk-panel-section
%input.sk-input.contrast{:placeholder => 'Email', "sn-autofocus" => 'true', "should-focus" => "true", :name => 'email', :required => true, :type => 'email', 'ng-model' => 'formData.email', 'spellcheck' => 'false'} %input.sk-input.contrast{:placeholder => 'Email', "sn-autofocus" => 'true',
"should-focus" => "true", :name => 'email', :required => true, :type => 'email',
'ng-model' => 'formData.email', 'spellcheck' => 'false', "ng-model-options"=> "{allowInvalid: true}"}
%input.sk-input.contrast{:placeholder => 'Password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.user_password', 'sn-enter' => 'submitAuthForm()'} %input.sk-input.contrast{:placeholder => 'Password', :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.user_password', 'sn-enter' => 'submitAuthForm()'}
%input.sk-input.contrast{:placeholder => 'Confirm Password', "ng-if" => "formData.showRegister", :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.password_conf', 'sn-enter' => 'submitAuthForm()'} %input.sk-input.contrast{:placeholder => 'Confirm Password', "ng-if" => "formData.showRegister", :name => 'password', :required => true, :type => 'password', 'ng-model' => 'formData.password_conf', 'sn-enter' => 'submitAuthForm()'}
.sk-panel-row .sk-panel-row

7691
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@
"mocha": "^5.2.0", "mocha": "^5.2.0",
"serve-static": "^1.13.2", "serve-static": "^1.13.2",
"sn-stylekit": "2.0.14", "sn-stylekit": "2.0.14",
"snjs": "file:~/Desktop/sn/dev/snjs", "snjs": "0.2.3",
"standard-file-js": "file:~/Desktop/sn/dev/sfjs" "standard-file-js": "0.3.60"
} }
} }

View File

@@ -56,6 +56,10 @@ export default class Factory {
return new SFModelManager(); return new SFModelManager();
} }
static yesterday() {
return new Date(new Date().setDate(new Date().getDate() - 1));
}
static createItemParams() { static createItemParams() {
var params = { var params = {
uuid: SFJS.crypto.generateUUIDSync(), uuid: SFJS.crypto.generateUUIDSync(),

View File

@@ -255,13 +255,7 @@ describe("notes and tags", () => {
let note = modelManager.allItemsMatchingTypes(["Note"])[0]; let note = modelManager.allItemsMatchingTypes(["Note"])[0];
let tag = modelManager.allItemsMatchingTypes(["Tag"])[0]; let tag = modelManager.allItemsMatchingTypes(["Tag"])[0];
// Usually content_type will be provided by a server response var duplicateTag = await modelManager.duplicateItemAndAddAsConflict(tag);
var duplicateParams = _.merge({content_type: "Tag"}, tag);
duplicateParams.uuid = null;
expect(duplicateParams.content_type).to.equal("Tag");
var duplicateTag = await modelManager.createConflictedItem(duplicateParams);
modelManager.addConflictedItem(duplicateTag, tag);
expect(tag.uuid).to.not.equal(duplicateTag.uuid); expect(tag.uuid).to.not.equal(duplicateTag.uuid);
@@ -293,15 +287,9 @@ describe("notes and tags", () => {
let note = modelManager.allItemsMatchingTypes(["Note"])[0]; let note = modelManager.allItemsMatchingTypes(["Note"])[0];
let tag = modelManager.allItemsMatchingTypes(["Tag"])[0]; let tag = modelManager.allItemsMatchingTypes(["Tag"])[0];
// Usually content_type will be provided by a server response var duplicateNote = await modelManager.duplicateItemAndAddAsConflict(note);
var duplicateParams = _.merge({content_type: "Note"}, note);
duplicateParams.uuid = null;
var duplicateNote = await modelManager.createConflictedItem(duplicateParams);
modelManager.addConflictedItem(duplicateNote, note);
expect(note.uuid).to.not.equal(duplicateNote.uuid); expect(note.uuid).to.not.equal(duplicateNote.uuid);
expect(duplicateNote.tags.length).to.equal(note.tags.length); expect(duplicateNote.tags.length).to.equal(note.tags.length);
}); });
@@ -579,6 +567,7 @@ describe("syncing", () => {
}) })
it('duplicating a tag should maintian its relationships', async () => { it('duplicating a tag should maintian its relationships', async () => {
await syncManager.loadLocalItems();
modelManager.handleSignout(); modelManager.handleSignout();
let pair = createRelatedNoteTagPair(); let pair = createRelatedNoteTagPair();
let noteParams = pair[0]; let noteParams = pair[0];
@@ -597,6 +586,7 @@ describe("syncing", () => {
expect(modelManager.allItems.length).to.equal(2); expect(modelManager.allItems.length).to.equal(2);
tag.title = `${Math.random()}` tag.title = `${Math.random()}`
tag.updated_at = Factory.yesterday();
tag.setDirty(true); tag.setDirty(true);
expect(note.referencingObjects.length).to.equal(1); expect(note.referencingObjects.length).to.equal(1);