Changes to support title change in metadata

pull/1/head
Caleb James DeLisle 7 years ago
parent 604415b32c
commit 415399ef64

@ -15,6 +15,9 @@ define([], function () {
var priv = {};
var dirty = true;
var changeHandlers = [];
var lazyChangeHandlers = [];
var rememberedTitle;
var checkUpdate = function (lazy) {
if (!dirty) { return; }
@ -45,11 +48,17 @@ define([], function () {
mdo[meta.user.netfluxId] = meta.user;
metadataObj.users = mdo;
var lazyUserStr = JSON.stringify(metadataLazyObj.users[meta.user.netfluxId]);
dirty = false;
if (lazy || lazyUserStr !== JSON.stringify(meta.user)) {
metadataLazyObj.users = mdo;
lazyChangeHandlers.forEach(function (f) { f(); });
}
if (metadataObj.title !== rememberedTitle) {
console.log("Title update\n" + metadataObj.title + '\n');
rememberedTitle = metadataObj.title;
}
dirty = false;
changeHandlers.forEach(function (f) { f(); });
};
var change = function (lazy) {
@ -101,6 +110,7 @@ define([], function () {
return metadataLazyObj;
},
onChange: function (f) { changeHandlers.push(f); },
onChangeLazy: function (f) { lazyChangeHandlers.push(f); },
isConnected : function () {
return members.indexOf(meta.user.netfluxId) !== -1;
},

@ -14,6 +14,7 @@ define([
if (ctx.cpNfInner) { return ctx.cpNfInner; }
options.sframeChan = ctx.sframeChan;
ctx.cpNfInner = CpNfInner.start(options);
ctx.cpNfInner.metadataMgr.onChangeLazy(options.onLocal);
return ctx.cpNfInner;
};

@ -347,12 +347,12 @@ define([
defaultTitle: Title.defaultTitle,
type: 'pad'
}
};*/
};
if (!initializing) {
hjson[3].metadata.title = Title.title;
} else if (Cryptpad.initialName && !hjson[3].metadata.title) {
hjson[3].metadata.title = Cryptpad.initialName;
}
}*/
return stringify(hjson);
};

Loading…
Cancel
Save