From 77f2960dbdce428f966557c7e6fa3e3e9cce4d9f Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 23 Aug 2021 10:43:51 -0300 Subject: [PATCH] [FIX] Omnichannel custom fields are not rendered properly (#3295) * [FIX] Permissions to edit livechat * [FIX] Custom fields labels and values * refactor field * Added the permission to edit livechat room custom fields * Fix the inputs.focus() Co-authored-by: Levy Costa Co-authored-by: Diego Mello --- app/views/LivechatEditView.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/LivechatEditView.js b/app/views/LivechatEditView.js index 78b72848..f92215ff 100644 --- a/app/views/LivechatEditView.js +++ b/app/views/LivechatEditView.js @@ -55,12 +55,12 @@ const LivechatEditView = ({ const visitorCustomFields = result.customFields .filter(field => field.visibility !== 'hidden' && field.scope === 'visitor') .map(field => ({ [field._id]: (visitor.livechatData && visitor.livechatData[field._id]) || '' })) - .reduce((ret, field) => ({ [field]: field, ...ret })); + .reduce((ret, field) => ({ ...field, ...ret })); const livechatCustomFields = result.customFields .filter(field => field.visibility !== 'hidden' && field.scope === 'room') .map(field => ({ [field._id]: (livechat.livechatData && livechat.livechatData[field._id]) || '' })) - .reduce((ret, field) => ({ [field]: field, ...ret })); + .reduce((ret, field) => ({ ...field, ...ret })); return setCustomFields({ visitor: visitorCustomFields, livechat: livechatCustomFields }); } @@ -188,7 +188,7 @@ const LivechatEditView = ({ onSubmitEditing={() => { const keys = Object.keys(customFields?.visitor || {}); if (keys.length > 0) { - const key = keys.pop(); + const key = keys[0]; inputs[key].focus(); } else { inputs.topic.focus(); @@ -205,7 +205,7 @@ const LivechatEditView = ({ onChangeText={text => onChangeText(key, text)} onSubmitEditing={() => { if (array.length - 1 > index) { - return inputs[array[index + 1]].focus(); + return inputs[array[index + 1][0]].focus(); } inputs.topic.focus(); }}