From 7ff939efd54f1e056a1e10e261183b200f435034 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:28:41 +0530 Subject: [PATCH 1/6] fix: TypeError cannot read properties of undefined (reading 'id') (#9947) --- .../conversation/conversationCardComponents/CardLabels.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue b/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue index 39fd9e047..6c719fc01 100644 --- a/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue +++ b/app/javascript/dashboard/components/widgets/conversation/conversationCardComponents/CardLabels.vue @@ -13,8 +13,8 @@ export default { const accountLabels = useMapGetter('labels/getLabels'); const activeLabels = computed(() => { - return props.conversationLabels.map(label => - accountLabels.value.find(l => l.title === label) + return accountLabels.value.filter(({ title }) => + props.conversationLabels.includes(title) ); }); @@ -83,7 +83,7 @@ export default { Date: Tue, 13 Aug 2024 19:16:15 +0530 Subject: [PATCH 2/6] fix: TypeError: t.messages.at is not a function (#9950) --- app/javascript/dashboard/helper/conversationHelper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/helper/conversationHelper.js b/app/javascript/dashboard/helper/conversationHelper.js index 3f40a98fb..66194e003 100644 --- a/app/javascript/dashboard/helper/conversationHelper.js +++ b/app/javascript/dashboard/helper/conversationHelper.js @@ -47,12 +47,13 @@ export const filterDuplicateSourceMessages = (messages = []) => { * @returns {Object} The last message of the conversation. */ export const getLastMessage = m => { - const lastMessageIncludingActivity = m.messages.at(-1); + const lastMessageIncludingActivity = m.messages[m.messages.length - 1]; const nonActivityMessages = m.messages.filter( message => message.message_type !== 2 ); - const lastNonActivityMessageInStore = nonActivityMessages.at(-1); + const lastNonActivityMessageInStore = + nonActivityMessages[nonActivityMessages.length - 1]; const lastNonActivityMessageFromAPI = m.last_non_activity_message; From b998f048267a342ac2dd1474d039801f2b7d0130 Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 13 Aug 2024 19:31:31 +0530 Subject: [PATCH 3/6] feat: Update the design for user management page (#9948) This PR is the part of the settings page design update series. This PR updates the design for the user management page. Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> --- .../dashboard/helper/featureHelper.js | 1 + .../dashboard/i18n/locale/en/agentMgmt.json | 4 +- .../dashboard/settings/agents/Index.vue | 400 +++++++++--------- .../dashboard/settings/agents/agent.routes.js | 4 +- 4 files changed, 194 insertions(+), 215 deletions(-) diff --git a/app/javascript/dashboard/helper/featureHelper.js b/app/javascript/dashboard/helper/featureHelper.js index 5a5edba6d..c3dd3d880 100644 --- a/app/javascript/dashboard/helper/featureHelper.js +++ b/app/javascript/dashboard/helper/featureHelper.js @@ -1,5 +1,6 @@ const FEATURE_HELP_URLS = { agent_bots: 'https://chwt.app/hc/agent-bots', + agents: 'https://chwt.app/hc/agents', audit_logs: 'https://chwt.app/hc/audit-logs', campaigns: 'https://chwt.app/hc/campaigns', canned_responses: 'https://chwt.app/hc/canned', diff --git a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json index d01730ed8..442b6becd 100644 --- a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json @@ -3,7 +3,8 @@ "HEADER": "Agents", "HEADER_BTN_TXT": "Add Agent", "LOADING": "Fetching Agent List", - "SIDEBAR_TXT": "

Agents

An Agent is a member of your Customer Support team.

Agents will be able to view and reply to messages from your users. The list shows all agents currently in your account.

Click on Add Agent to add a new agent. Agent you add will receive an email with a confirmation link to activate their account, after which they can access Chatwoot and respond to messages.

Access to Chatwoot's features are based on following roles.

Agent - Agents with this role can only access inboxes, reports and conversations. They can assign conversations to other agents or themselves and resolve conversations.

Administrator - Administrator will have access to all Chatwoot features enabled for your account, including settings, along with all of a normal agents' privileges.

", + "DESCRIPTION": "An agent is a member of your customer support team who can view and respond to user messages. The list below shows all the agents in your account.", + "LEARN_MORE": "Learn about user roles", "AGENT_TYPES": { "ADMINISTRATOR": "Administrator", "AGENT": "Agent" @@ -33,7 +34,6 @@ "PLACEHOLDER": "Please select a role", "ERROR": "Role is required" }, - "EMAIL": { "LABEL": "Email Address", "PLACEHOLDER": "Please enter an email address of the agent" diff --git a/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue index 21000a6fd..cb0402e12 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/agents/Index.vue @@ -1,230 +1,208 @@ - diff --git a/app/javascript/dashboard/routes/dashboard/settings/agents/agent.routes.js b/app/javascript/dashboard/routes/dashboard/settings/agents/agent.routes.js index 854450c5d..d7f881204 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/agents/agent.routes.js +++ b/app/javascript/dashboard/routes/dashboard/settings/agents/agent.routes.js @@ -1,12 +1,12 @@ import { frontendURL } from '../../../../helper/URLHelper'; -const SettingsContent = () => import('../Wrapper.vue'); +const SettingsWrapper = () => import('../SettingsWrapper.vue'); const AgentHome = () => import('./Index.vue'); export default { routes: [ { path: frontendURL('accounts/:accountId/settings/agents'), - component: SettingsContent, + component: SettingsWrapper, props: { headerTitle: 'AGENT_MGMT.HEADER', icon: 'people', From 207933ed70b0815a1cb4575c7f1e8878887368d8 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:22:51 +0530 Subject: [PATCH 4/6] fix: TypeError cannot read properties of undefined (reading '$el') (#9951) # Pull Request Template ## Description This PR will fix an error `TypeError cannot read properties of undefined (reading '$el')` with the keyboard shortcut `Alt+KeyA` for triggering the file picker. **Issue** I couldn't able reproduce this issue. It might be because `$children` was unavailable at the time of access. **Solution** Previously, it relied on `$children`. Now, it uses the more reliable `querySelector` method to find the target element. Fixes https://chatwoot-p3.sentry.io/issues/5708410274/?alert_rule_id=15157525&alert_timestamp=1723552508790&alert_type=email&environment=production¬ification_uuid=be5966b2-f17d-4273-8709-98e3322f1f6f&project=4507182691975168&referrer=alert_email ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? **Test cases** 1. Open a conversation 2. And click `Alt+KeyA` to trigger the file picker. 3. See if there is any issue or errors. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../widgets/WootWriter/ReplyBottomPanel.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue index 168f2448a..e4ab0b41d 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/ReplyBottomPanel.vue @@ -116,29 +116,27 @@ export default { setup() { const { setSignatureFlagForInbox, fetchSignatureFlagFromUISettings } = useUISettings(); + const uploadRef = ref(null); // TODO: This is really hacky, we need to replace the file picker component with // a custom one, where the logic and the component markup is isolated. // Once we have the custom component, we can remove the hacky logic below. - const uploadTriggerButton = computed(() => { - if (uploadRef.value) { - return uploadRef.value.$children[1].$el; - } - - return null; - }); + const uploadRefElem = computed(() => uploadRef.value?.$el); const keyboardEvents = { 'Alt+KeyA': { action: () => { - uploadTriggerButton.value.click(); + const uploadTriggerButton = document.querySelector( + '#conversationAttachment' + ); + uploadTriggerButton.click(); }, allowOnFocusedInput: true, }, }; watchEffect(() => { - useKeyboardEvents(keyboardEvents, uploadTriggerButton); + useKeyboardEvents(keyboardEvents, uploadRefElem); }); return { From dd8abe975cd37b23c69ea0cd9b8140d60b7b9bf5 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:56:30 +0530 Subject: [PATCH 5/6] feat: Rewrite `configMixin` to a composable (#9921) # Pull Request Template ## Description This PR will replace the usage of `configMixin` with the `useConfig` composable. **Files updated** 1. dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue 2. dashboard/components/widgets/conversation/MessagesView.vue 3. dashboard/routes/dashboard/settings/inbox/Settings.vue **(Not used)** 4. dashboard/routes/dashboard/settings/inbox/FinishSetup.vue **(Not used)** 5. dashboard/routes/dashboard/settings/inbox/settingsPage/CollaboratorsPage.vue 6. dashboard/routes/dashboard/settings/profile/NotificationPreferences.vue **(Not used)** 7. dashboard/routes/dashboard/settings/profile/AudioNotifications.vue **(Not used)** 8. dashboard/routes/dashboard/settings/sla/Index.vue **(Not used)** 9. dashboard/routes/dashboard/settings/account/Index.vue 10. survey/views/Response.vue **(Not used)** Fixes https://linear.app/chatwoot/issue/CW-3464/rewrite-configmixin-mixin-to-a-composable ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Test in the component related pages ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../sidebarComponents/SecondaryNavItem.vue | 5 +- .../widgets/conversation/MessagesView.vue | 6 ++- .../composables/spec/useConfig.spec.js | 51 +++++++++++++++++++ .../dashboard/composables/useConfig.js | 46 +++++++++++++++++ .../dashboard/settings/account/Index.vue | 6 +-- .../dashboard/settings/inbox/FinishSetup.vue | 10 ++-- .../dashboard/settings/inbox/Settings.vue | 3 +- .../inbox/settingsPage/CollaboratorsPage.vue | 7 +-- .../settings/profile/AudioNotifications.vue | 2 - .../profile/NotificationPreferences.vue | 2 - .../routes/dashboard/settings/sla/Index.vue | 2 - app/javascript/shared/mixins/configMixin.js | 20 -------- app/javascript/survey/views/Response.vue | 3 -- 13 files changed, 116 insertions(+), 47 deletions(-) create mode 100644 app/javascript/dashboard/composables/spec/useConfig.spec.js create mode 100644 app/javascript/dashboard/composables/useConfig.js delete mode 100644 app/javascript/shared/mixins/configMixin.js diff --git a/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue b/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue index 2132ffc9e..be013c069 100644 --- a/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue +++ b/app/javascript/dashboard/components/layout/sidebarComponents/SecondaryNavItem.vue @@ -1,7 +1,7 @@