From c25a75f497e2a9f81354091be6ddf296cb73a2f9 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Sat, 18 Jan 2025 18:31:07 +0530 Subject: [PATCH 1/3] feat: check if item is present (#10715) --- .../dashboard/components-next/message/bubbles/Form.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/app/javascript/dashboard/components-next/message/bubbles/Form.vue b/app/javascript/dashboard/components-next/message/bubbles/Form.vue index 0bf92a07b..ca9af4994 100644 --- a/app/javascript/dashboard/components-next/message/bubbles/Form.vue +++ b/app/javascript/dashboard/components-next/message/bubbles/Form.vue @@ -30,6 +30,7 @@ const formValues = computed(() => { if (contentType.value === CONTENT_TYPES.INPUT_SELECT) { const [item] = contentAttributes.value?.submittedValues ?? []; + if (!item) return []; return [ { From a8ecbd391953eca489b67ce03d7cbb2d32c1c23b Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:34:23 +0530 Subject: [PATCH 2/3] chore: Auto-fetch previous page on last item deletion (#10714) # Pull Request Template ## Description This PR fixes an issue where deleting the last item on the last page of responses/documents, would show an empty state instead of loading the previous page. Fixes > If you have pending responses spanning 2 or more pages .. and you delete the last response in the last page.. instead of showing the previous page the system show empty state. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? **Loom video** https://www.loom.com/share/b0e89f774ccd45dab0e8dba2c34bd1ac?sid=d9923bcd-5030-42d9-9b7f-170df5297cfd ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] 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 --- .../captain/pageComponents/DeleteDialog.vue | 3 +++ .../dashboard/routes/dashboard/captain/documents/Index.vue | 7 +++++++ .../dashboard/routes/dashboard/captain/responses/Index.vue | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/app/javascript/dashboard/components-next/captain/pageComponents/DeleteDialog.vue b/app/javascript/dashboard/components-next/captain/pageComponents/DeleteDialog.vue index 3301e085d..31e18394f 100644 --- a/app/javascript/dashboard/components-next/captain/pageComponents/DeleteDialog.vue +++ b/app/javascript/dashboard/components-next/captain/pageComponents/DeleteDialog.vue @@ -20,6 +20,8 @@ const props = defineProps({ }, }); +const emit = defineEmits(['deleteSuccess']); + const { t } = useI18n(); const store = useStore(); const deleteDialogRef = ref(null); @@ -30,6 +32,7 @@ const deleteEntity = async payload => { try { await store.dispatch(`captain${props.type}/delete`, payload); + emit('deleteSuccess'); useAlert(t(`CAPTAIN.${i18nKey.value}.DELETE.SUCCESS_MESSAGE`)); } catch (error) { useAlert(t(`CAPTAIN.${i18nKey.value}.DELETE.ERROR_MESSAGE`)); diff --git a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue index af2cbc0ef..cfe088055 100644 --- a/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/captain/documents/Index.vue @@ -85,6 +85,12 @@ const handleAssistantFilterChange = assistant => { const onPageChange = page => fetchDocuments(page); +const onDeleteSuccess = () => { + if (documents.value?.length === 0 && documentsMeta.value?.page > 1) { + onPageChange(documentsMeta.value.page - 1); + } +}; + onMounted(() => { if (!assistants.value.length) { store.dispatch('captainAssistants/get'); @@ -146,6 +152,7 @@ onMounted(() => { ref="deleteDocumentDialog" :entity="selectedDocument" type="Documents" + @delete-success="onDeleteSuccess" /> diff --git a/app/javascript/dashboard/routes/dashboard/captain/responses/Index.vue b/app/javascript/dashboard/routes/dashboard/captain/responses/Index.vue index 6fddcd465..e62f8f0e1 100644 --- a/app/javascript/dashboard/routes/dashboard/captain/responses/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/captain/responses/Index.vue @@ -129,6 +129,12 @@ const fetchResponses = (page = 1) => { const onPageChange = page => fetchResponses(page); +const onDeleteSuccess = () => { + if (responses.value?.length === 0 && responseMeta.value?.page > 1) { + onPageChange(responseMeta.value.page - 1); + } +}; + const handleStatusFilterChange = ({ value }) => { selectedStatus.value = value; isStatusFilterOpen.value = false; @@ -211,6 +217,7 @@ onMounted(() => { ref="deleteDialog" :entity="selectedResponse" type="Responses" + @delete-success="onDeleteSuccess" /> Date: Mon, 20 Jan 2025 14:34:33 +0530 Subject: [PATCH 3/3] fix: Vite dev build fails due to sass (#10716) # Pull Request Template ## Description Fixes https://linear.app/chatwoot/issue/CW-3853/vite-dev-build-fails-due-to-dart-sass **Other issue** | First Header | Second Header | | ------------- | ------------- | | ![image](https://github.com/user-attachments/assets/e99ac2bc-0b8a-44d1-aa58-9e10e00b5ad5) | ![image](https://github.com/user-attachments/assets/c987f70c-f5f5-4606-a498-00a6fe6b6525) | ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] 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 --- .../reports/components/Filters/Labels.vue | 15 ++++------ .../reports/components/ReportFilters.vue | 28 ++++++++----------- .../reports/components/ReportsWrapper.vue | 8 +++--- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Filters/Labels.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Filters/Labels.vue index 655e82f7b..68cc4baf2 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/Filters/Labels.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/Filters/Labels.vue @@ -39,15 +39,13 @@ export default { @update:model-value="handleInput" > @@ -57,10 +55,9 @@ export default { :style="{ backgroundColor: props.option.color }" class="flex-shrink-0 w-5 h-5 border border-solid rounded-full border-slate-100 dark:border-slate-800" /> - - - {{ props.option.title }} - + + + {{ props.option.title }} diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/ReportFilters.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/ReportFilters.vue index b41851180..053ae7cd7 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/ReportFilters.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/ReportFilters.vue @@ -179,18 +179,16 @@ export default { @update:model-value="changeFilterSelection" >