From 1ecb61fe852d45b405c980be3ed3365f3c931dec Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 24 Jan 2020 10:30:23 -0500 Subject: [PATCH 1/3] put an ugly red border on support thread messages from admins --- www/admin/app-admin.less | 3 +++ www/support/ui.js | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index 10e178308..e9ba67325 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -23,5 +23,8 @@ display: flex; flex-flow: column; } + .cp-support-fromadmin { + border: 1px solid red !important; // XXX + } } diff --git a/www/support/ui.js b/www/support/ui.js index 42ee89c94..c008e219c 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -170,7 +170,9 @@ define([ var privateData = metadataMgr.getPrivateData(); // Check content.sender to see if it comes from us or from an admin - var fromMe = content.sender && content.sender.edPublic === privateData.edPublic; + var senderKey = content.sender && content.sender.edPublic; + var fromMe = senderKey === privateData.edPublic; + var fromAdmin = ctx.adminKeys.indexOf(senderKey) !== -1; var userData = h('div.cp-support-showdata', [ Messages.support_showData, @@ -183,7 +185,7 @@ define([ }); var name = Util.fixHTML(content.sender.name) || Messages.anonymous; - return h('div.cp-support-list-message', { + return h('div.cp-support-list-message' + (fromAdmin? '.cp-support-fromadmin': ''), { 'data-hash': hash }, [ h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), [ @@ -219,6 +221,7 @@ define([ common: common, isAdmin: isAdmin, pinUsage: pinUsage || false, + adminKeys: Array.isArray(ApiConfig.adminKeys)? ApiConfig.adminKeys.slice(): [], }; ui.sendForm = function (id, form, dest) { From 9a53b3b9fd69d03e1f1f2341bcc9b8dec0f3b171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Benqu=C3=A9?= Date: Fri, 24 Jan 2020 16:52:44 +0000 Subject: [PATCH 2/3] style messages - blue text for messages from admins - red text and background for messages needing a response. --- www/admin/app-admin.less | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index e9ba67325..eb2a8c0f8 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -23,8 +23,26 @@ display: flex; flex-flow: column; } + + .cp-support-list-actions { + margin: 10px 0px 10px 2px; + } + .cp-support-list-message { + &:last-child:not(.cp-support-fromadmin) { + color: @colortheme_cp-red; + background-color: lighten(@colortheme_cp-red, 25%); + .cp-support-showdata { + background-color: lighten(@colortheme_cp-red, 30%); + } + } + } + .cp-support-fromadmin { - border: 1px solid red !important; // XXX + color: @colortheme_logo-2; + background-color: #FFF; + .cp-support-message-content { + color: @colortheme_logo-2; + } } } From f0f91b7ab2c56c8075b0d1fe26f96ba6e13f9e81 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 Jan 2020 13:43:31 +0100 Subject: [PATCH 3/3] Create the folders recursively if a new pad path doesn't exist --- www/common/outer/userObject.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index 5a2693fd9..004018c12 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -438,14 +438,24 @@ define([ parentEl.push(id); return; } - // Add to root if path is ROOT or if no path + // Add to root if no path var filesList = exp.getFiles([ROOT, TRASH, 'hrefArray']); - if (path && exp.isPathIn(newPath, [ROOT]) || filesList.indexOf(id) === -1) { - parentEl = exp.find(newPath || [ROOT]); + if (filesList.indexOf(id) === -1 && !newPath) { + newPath = [ROOT]; + } + // Add to root + if (path && exp.isPathIn(newPath, [ROOT])) { + var parentEl = exp.find(newPath); if (parentEl) { var newName = exp.getAvailableName(parentEl, Hash.createChannelId()); parentEl[newName] = id; return; + } else { + parentEl = exp.find([ROOT]); + newPath.slice(1).forEach(function (folderName) { + parentEl = parentEl[folderName] = parentEl[folderName] || {}; + }); + parentEl[Hash.createChannelId()] = id; } } };