From 179df27e3c70606ad9a7b8bfe78fb479b87328e7 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 17 Sep 2018 11:23:35 +0200 Subject: [PATCH] Fix autostore not displaying the error message when over pin limit --- customize.dist/src/less2/include/corner.less | 1 + www/common/common-ui-elements.js | 11 +++++++---- www/common/cryptpad-common.js | 3 +++ www/common/outer/async-store.js | 2 +- www/common/sframe-common-outer.js | 2 +- www/slide/app-slide.less | 3 ++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/customize.dist/src/less2/include/corner.less b/customize.dist/src/less2/include/corner.less index 6e9f22b47..8df0f172a 100644 --- a/customize.dist/src/less2/include/corner.less +++ b/customize.dist/src/less2/include/corner.less @@ -113,6 +113,7 @@ padding: 5px; color: @colortheme_base; margin-left: 5px; + outline: none; &.cp-corner-primary { background-color: @corner-button-ok; font-weight: bold; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5fafd241e..b956c5b93 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2396,13 +2396,16 @@ define([ modal.delete(); }); $(store).click(function () { - UIElements.displayCrowdfunding(common); - modal.delete(); common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) { - if (err || (obj && obj.error)) { - console.error(err || obj.error); + var error = err || (obj && obj.error); + if (error) { + if (error === 'E_OVER_LIMIT') { + return void UI.warn(Messages.pinLimitReached); + } return void UI.warn(Messages.autostore_error); } + modal.delete(); + UIElements.displayCrowdfunding(common); UI.log(Messages.autostore_saved); }); }); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index a04409139..150d2a469 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -345,6 +345,9 @@ define([ }; common.getPadAttribute = function (attr, cb, href) { href = Hash.getRelativeHref(href || window.location.href); + if (!href) { + return void cb('E404'); + } postMessage("GET_PAD_ATTRIBUTE", { href: href, attr: attr, diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index c9d52d126..da5edd951 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -465,7 +465,7 @@ define([ if (data.password) { pad.password = data.password; } if (data.channel) { pad.channel = data.channel; } store.manager.addPad(data.path, pad, function (e) { - if (e) { return void cb({error: "Error while adding the pad:"+ e}); } + if (e) { return void cb({error: e}); } sendDriveEvent('DRIVE_CHANGE', { path: ['drive', UserObject.FILES_DATA] }, clientId); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index b99fa59eb..dcffcc606 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -371,7 +371,7 @@ define([ forceSave: true }; Cryptpad.setPadTitle(data, function (err) { - cb(err); + cb({error: err}); }); }); sframeChan.on('Q_IS_PAD_STORED', function (data, cb) { diff --git a/www/slide/app-slide.less b/www/slide/app-slide.less index 27dcef34e..8381a5777 100644 --- a/www/slide/app-slide.less +++ b/www/slide/app-slide.less @@ -107,6 +107,7 @@ .cp-app-slide-viewer { width: 50vw; overflow: hidden; + z-index: 998; div#cp-app-slide-modal:not(.cp-app-slide-shown) { position: relative; top: auto; @@ -417,4 +418,4 @@ pre.cp-slide-css-error { color: white; } -} \ No newline at end of file +}