Fix an issue where metadata could be duplicated in the realtime userdoc
This commit is contained in:
parent
69e8f54e8f
commit
c0b8aac792
@ -261,8 +261,8 @@ define([
|
|||||||
var updateUserList = function(shjson) {
|
var updateUserList = function(shjson) {
|
||||||
// Extract the user list (metadata) from the hyperjson
|
// Extract the user list (metadata) from the hyperjson
|
||||||
var hjson = JSON.parse(shjson);
|
var hjson = JSON.parse(shjson);
|
||||||
var peerUserList = hjson[hjson.length-1];
|
var peerUserList = hjson[3];
|
||||||
if(peerUserList.metadata) {
|
if(peerUserList && peerUserList.metadata) {
|
||||||
var userData = peerUserList.metadata;
|
var userData = peerUserList.metadata;
|
||||||
// Update the local user data
|
// Update the local user data
|
||||||
addToUserList(userData);
|
addToUserList(userData);
|
||||||
@ -313,7 +313,7 @@ define([
|
|||||||
var onReady = realtimeOptions.onReady = function (info) {
|
var onReady = realtimeOptions.onReady = function (info) {
|
||||||
module.patchText = TextPatcher.create({
|
module.patchText = TextPatcher.create({
|
||||||
realtime: info.realtime,
|
realtime: info.realtime,
|
||||||
logging: false,
|
logging: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
module.realtime = info.realtime;
|
module.realtime = info.realtime;
|
||||||
@ -342,7 +342,7 @@ define([
|
|||||||
|
|
||||||
// append the userlist to the hyperjson structure
|
// append the userlist to the hyperjson structure
|
||||||
if(Object.keys(myData).length > 0) {
|
if(Object.keys(myData).length > 0) {
|
||||||
hjson[hjson.length] = {metadata: userList};
|
hjson[3] = {metadata: userList};
|
||||||
}
|
}
|
||||||
// stringify the json and send it into chainpad
|
// stringify the json and send it into chainpad
|
||||||
var shjson = stringify(hjson);
|
var shjson = stringify(hjson);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user