fix for @mmalmi 's Identifi

This commit is contained in:
Mark Nadal 2018-12-20 18:15:49 -08:00
parent 3d796b4014
commit c7333fab42
2 changed files with 10 additions and 11 deletions

15
gun.js
View File

@ -1385,7 +1385,7 @@
}); });
return gun; return gun;
} }
as.$ = gun = root.get(as.soul); as.$ = root.get(as.soul);
as.ref = as.$; as.ref = as.$;
ify(as); ify(as);
return gun; return gun;
@ -1540,8 +1540,8 @@
as.data = obj_put({}, at.get, as.data); as.data = obj_put({}, at.get, as.data);
}); });
} }
tmp = tmp || at.get; tmp = tmp || at.soul || at.link || at.dub;// || at.get;
at = (at.root.$.get(tmp)._); at = tmp? (at.root.$.get(tmp)._) : at;
as.soul = tmp; as.soul = tmp;
data = as.data; data = as.data;
} }
@ -1759,13 +1759,12 @@
var gun = this, soul; var gun = this, soul;
cb = cb || function(){}; cb = cb || function(){};
opt = opt || {}; opt.item = opt.item || item; opt = opt || {}; opt.item = opt.item || item;
if(soul = Gun.node.soul(item)){ return gun.set(gun.back(-1).get(soul), cb, opt) } if(soul = Gun.node.soul(item)){ item = Gun.obj.put({}, soul, Gun.val.link.ify(soul)) }
if(!Gun.is(item)){ if(!Gun.is(item)){
var id = gun.back('opt.uuid')(); if(Gun.obj.is(item)){;
if(id && Gun.obj.is(item)){ item = gun.back(-1).get(soul = soul || Gun.node.soul(item) || gun.back('opt.uuid')()).put(item);
return gun.set(gun._.root.$.put(item, id), cb, opt);
} }
return gun.get((Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt); return gun.get(soul || (Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt);
} }
item.get(function(soul, o, msg){ item.get(function(soul, o, msg){
if(!soul){ return cb.call(gun, {err: Gun.log('Only a node can be linked! Not "' + msg.put + '"!')}) } if(!soul){ return cb.call(gun, {err: Gun.log('Only a node can be linked! Not "' + msg.put + '"!')}) }

View File

@ -3,8 +3,8 @@ var config = {
port: 8765, port: 8765,
servers: 2, servers: 2,
browsers: 2, browsers: 2,
each: 100000, each: 500,
burst: 2, burst: 50,
wait: 1, wait: 1,
notrad: true, notrad: true,
route: { route: {