diff --git a/bower.json b/bower.json index afa2e3784..b04ff3a6b 100644 --- a/bower.json +++ b/bower.json @@ -38,6 +38,7 @@ "scrypt-async": "1.2.0", "require-css": "0.1.10", "less": "^2.7.2", - "bootstrap": "#v4.0.0-alpha.6" + "bootstrap": "#v4.0.0-alpha.6", + "diff-dom": "2.1.1" } } diff --git a/rpc.js b/rpc.js index 3a97dc80d..83f2010a2 100644 --- a/rpc.js +++ b/rpc.js @@ -583,9 +583,10 @@ var resetUserPins = function (Env, publicKey, channelList, cb) { if (e) { return void cb(e); } var pinSize = sumChannelSizes(sizes); - getFreeSpace(Env, publicKey, function (e, free) { + + getLimit(Env, publicKey, function (e, limit) { if (e) { - WARN('getFreeSpace', e); + WARN('[RESET_ERR]', e); return void cb(e); } @@ -597,7 +598,7 @@ var resetUserPins = function (Env, publicKey, channelList, cb) { They will not be able to pin additional pads until they upgrade or delete enough files to go back under their limit. */ - if (pinSize > free && session.hasPinned) { return void(cb('E_OVER_LIMIT')); } + if (pinSize > limit && session.hasPinned) { return void(cb('E_OVER_LIMIT')); } pinStore.message(publicKey, JSON.stringify(['RESET', channelList]), function (e) { if (e) { return void cb(e); } diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 81175b5fe..96061b499 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -832,7 +832,9 @@ define([ if (!pinsReady()) { return void cb('RPC_NOT_READY'); } var account = common.account; - if (typeof(account.limit) !== 'number' || + + var ALWAYS_REVALIDATE = true; + if (ALWAYS_REVALIDATE || typeof(account.limit) !== 'number' || typeof(account.plan) !== 'string' || typeof(account.note) !== 'string') { return void rpc.getLimit(function (e, limit, plan, note) { @@ -895,7 +897,6 @@ define([ var $container = $('', {'class':'limit-container'}); var todo; var updateUsage = window.updateUsage = common.notAgainForAnother(function () { - console.log("updating usage bar"); common.getPinnedUsage(todo); }, LIMIT_REFRESH_RATE); @@ -965,21 +966,12 @@ define([ }; setInterval(function () { - var t = updateUsage(); - if (t) { - console.log("usage already updated. eligible for refresh in %sms", t); - } + updateUsage(); }, LIMIT_REFRESH_RATE * 3); updateUsage(); getProxy().on('change', ['drive'], function () { - var t = updateUsage(); - if (t) { - console.log("usage bar update throttled due to overuse." + - " Eligible for update in %sms", t); - } else { - console.log("usage bar updated"); - } + updateUsage(); }); cb(null, $container); }; @@ -1233,18 +1225,18 @@ define([ } if (decrypted.blob) { - size = decrypted.blob.size + size = decrypted.blob.size; } - var sizeMb = Cryptpad.bytesToMegabytes(size); + var sizeMb = common.bytesToMegabytes(size); var $btn = $(root).find('button'); $btn.addClass('btn btn-success') .attr('type', 'download') - .html(function (i, html) { + .html(function () { var text = Messages.download_mt_button + '
'; if (title) { - text += '' + Cryptpad.fixHTML(title) + '
'; + text += '' + common.fixHTML(title) + '
'; } if (size) { text += '' + Messages._getKey('formattedMB', [sizeMb]) + ''; diff --git a/www/slide/main.js b/www/slide/main.js index 7c2b6d0b4..e14b194c5 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -470,6 +470,7 @@ define([ }).append($('', {'class': 'drawer'}).text(Messages.printText)); // TODO reenable this when it is working again + $printButton = $printButton; //$drawer.append($printButton); var $slideOptions = $('