From e698ee586a1c881611e45e98350afdef695d51b3 Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Wed, 28 Jan 2015 00:47:44 -0700 Subject: [PATCH] fixed stickies' path issue --- examples/package.json | 2 +- gun.js | 7 +++++-- package.json | 2 +- test/common.js | 14 ++++++++++++++ web/forrest-notes.txt | 6 +++--- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/examples/package.json b/examples/package.json index 0ca3be4a..1f9fdc1d 100644 --- a/examples/package.json +++ b/examples/package.json @@ -8,7 +8,7 @@ } , "dependencies": { "express": "~>4.9.0", - "gun": "0.0.9-l" + "gun": "0.0.9-m" } , "scripts": { "start": "node express.js", diff --git a/gun.js b/gun.js index 7cab294b..935eedb4 100644 --- a/gun.js +++ b/gun.js @@ -134,7 +134,7 @@ return {converge: true, incoming: true}; } } - return {err: Gun.log("you have not properly handled recursion through your data or filtered it as JSON")}; + return {err: "you have not properly handled recursion through your data or filtered it as JSON"}; } var context = Gun.shot(); context.HAM = {}; @@ -325,7 +325,10 @@ , val = gun._.node[field]; gun._.field = field; if(Gun.is.soul(val)){ // we might end on a link, so we must resolve - return gun.load(val).shot.then(trace); + return gun.load(val, function(){ + gun._ = this._; + trace(); + }); } else if(path.length){ // we cannot go any further, despite the fact there is more path, which means the thing we wanted does not exist. gun.shot('then').fire(); diff --git a/package.json b/package.json index be2f4a28..838af020 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "name": "gun" -, "version": "0.0.9-l" +, "version": "0.0.9-m" , "author": "Mark Nadal" , "description": "Graph engine." , "engines": { diff --git a/test/common.js b/test/common.js index 0b11702b..11049064 100644 --- a/test/common.js +++ b/test/common.js @@ -445,5 +445,19 @@ describe('Gun', function(){ }, 100); }); + it('load blank set get path get', function(done){ // stickies issue + gun.load("examples/list/foobar").blank(function(){ + this.set({ + id: 'foobar', + title: 'awesome title', + todos: {} + }); + }).get(function(data){ + expect(data.id).to.be('foobar'); + }).path('todos').get(function(todos){ + expect(todos).to.not.have.property('id'); + done(); + }); + }); }); }); diff --git a/web/forrest-notes.txt b/web/forrest-notes.txt index 3f565cd1..f6ca3f53 100644 --- a/web/forrest-notes.txt +++ b/web/forrest-notes.txt @@ -4,12 +4,12 @@ NOTES FROM FORREST: -2. gun.on() needs to be chainable with map and stuff. -1. Maybe make the map module core to gun? - 1 make raw HTTP work and document it, document that attach needs to be BEFORE listen. (talk to AJ) - 2 make sure you SUPPRESS your comments, Mark. + 1 make raw HTTP work and document it (DONE), document that attach needs to be BEFORE listen. (talk to AJ) + 2 make sure you SUPPRESS your comments, Mark. (DONE) 3 .get doesn't work on subsequent closures. WHYYY?? 4 HOW DO I DELETE? Mark: delete the actual field from the data, but not the stream/meta. 5 security ideas: have gun KEY regexs that are whitelist/blacklist. Off the keys. - 6 Forrest says, "arrays". + 6 Forrest says, "arrays". (LISTS!) 7 get VAL without gun meta-data. 8 make it work with just Gun('/gun');