diff --git a/www/common/metadata-manager.js b/www/common/metadata-manager.js index 6d20573d9..71a5dcc74 100644 --- a/www/common/metadata-manager.js +++ b/www/common/metadata-manager.js @@ -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; }, diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index a1f500832..2b9063e06 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -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; }; diff --git a/www/pad2/main.js b/www/pad2/main.js index 5779f002e..761a24138 100644 --- a/www/pad2/main.js +++ b/www/pad2/main.js @@ -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); };