diff --git a/rpc.js b/rpc.js index 60bc00ac3..a4821524b 100644 --- a/rpc.js +++ b/rpc.js @@ -540,9 +540,8 @@ var addPinned = function ( { Env.evPinnedPadsReady.reg(() => { channelList.forEach((c) => { - const x = Env.pinnedPads[c]; - if (!x) { return; } - delete x[publicKey]; + const x = Env.pinnedPads[c] = Env.pinnedPads[c] || {}; + x[publicKey] = 1; }); cb(); }); diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index bb06770c4..ca3d1dbfd 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -719,7 +719,7 @@ define([ return $titleContainer; }; - var createUnpinnedWarning = function (toolbar, config) { + var createUnpinnedWarning0 = function (toolbar, config) { if (Common.isLoggedIn()) { return; } var pd = config.metadataMgr.getPrivateData(); var o = pd.origin; @@ -728,7 +728,11 @@ define([ var cid = Hash.hrefToHexChannelId(url); Common.sendAnonRpcMsg('IS_CHANNEL_PINNED', cid, function (x) { if (x.error || !Array.isArray(x.response)) { return void console.log(x); } - if (x.response[0] === true) { return; } + if (x.response[0] === true) { + $('.cp-pad-not-pinned').remove(); + return; + } + if ($('.cp-pad-not-pinned').length) { return; } var pnpTitle = Messages._getKey('padNotPinned', ['','','','']); var pnpMsg = Messages._getKey('padNotPinned', [ '', @@ -759,6 +763,13 @@ define([ }); }; + var createUnpinnedWarning = function (toolbar, config) { + config.metadataMgr.onChange(function () { + createUnpinnedWarning0(toolbar, config); + }); + createUnpinnedWarning0(toolbar, config); + }; + var createPageTitle = function (toolbar, config) { if (config.title || !config.pageTitle) { return; } var $titleContainer = $('', {