From 1895d6cbd84d5b6d96a44c134a3df32bdfe7a01a Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 14 Sep 2018 11:21:52 +0200 Subject: [PATCH] Disable crowdfunding message for premium users --- www/common/common-constants.js | 4 +++- www/common/common-ui-elements.js | 3 +++ www/common/cryptpad-common.js | 2 +- www/common/sframe-common-outer.js | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/www/common/common-constants.js b/www/common/common-constants.js index 908134bec..c3eb447a2 100644 --- a/www/common/common-constants.js +++ b/www/common/common-constants.js @@ -13,6 +13,8 @@ define(function () { storageKey: 'filesData', tokenKey: 'loginToken', displayPadCreationScreen: 'displayPadCreationScreen', - deprecatedKey: 'deprecated' + deprecatedKey: 'deprecated', + // Sub + plan: 'CryptPad_plan' }; }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 2fcf0f3e0..b13432127 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2330,6 +2330,9 @@ define([ UIElements.displayCrowdfunding = function (common) { if (crowdfundingState) { return; } if (AppConfig.disableCrowdfundingMessages) { return; } + var priv = common.getMetadataMgr().getPrivateData(); + if (priv.plan) { return; } + crowdfundingState = true; setTimeout(function () { common.getAttribute(['general', 'crowdfunding'], function (err, val) { diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 75bc92129..a04409139 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1433,7 +1433,7 @@ define([ postMessage("INIT_RPC", null, waitFor(function (obj) { console.log('RPC handshake complete'); if (obj.error) { return; } - localStorage.plan = obj.plan; + localStorage[Constants.plan] = obj.plan; })); } else if (PINNING_ENABLED) { console.log('not logged in. pads will not be pinned'); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 781736958..b99fa59eb 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -262,6 +262,7 @@ define([ donateURL: Cryptpad.donateURL, upgradeURL: Cryptpad.upgradeURL }, + plan: localStorage[Utils.Constants.plan], isNewFile: isNewFile, isDeleted: isNewFile && window.location.hash.length > 0, forceCreationScreen: forceCreationScreen,