From 2a365bf19e4b0bfdbee2b4c318d5c847d5d1295c Mon Sep 17 00:00:00 2001 From: Baptiste Fontaine Date: Thu, 6 Feb 2025 06:08:57 +0100 Subject: [PATCH] feat: show email subject in conversation search results (#10843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Template ## Description This addresses #10842. It exposes `additional_attributes` in the conversations search endpoint, uses it in `SearchResultConversationsList` to pass `conversation.additional_attributes?.mail_subject` down to `SearchResultConversationItem`, which in turn displays it. Fixes #10842 ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? I have tested this locally by searching for conversations. See this screenshot where I searched for "noreply": ![Screenshot from 2025-02-05 11-04-54](https://github.com/user-attachments/assets/689e3e99-c20b-48a7-9c3e-35d45ffeafc1) I would love to add automated tests but I’m not sure how to do that. ## 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 - [ ] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin --- .../dashboard/i18n/locale/en/search.json | 3 +- .../SearchResultConversationItem.vue | 46 +++++++++++++------ .../SearchResultConversationsList.vue | 16 ++++++- .../search/conversations.json.jbuilder | 2 + 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/app/javascript/dashboard/i18n/locale/en/search.json b/app/javascript/dashboard/i18n/locale/en/search.json index 7a0fc4f82..3cb566813 100644 --- a/app/javascript/dashboard/i18n/locale/en/search.json +++ b/app/javascript/dashboard/i18n/locale/en/search.json @@ -24,6 +24,7 @@ "READ_MORE": "Read more", "WROTE": "wrote:", "FROM": "from", - "EMAIL": "email" + "EMAIL": "email", + "EMAIL_SUBJECT": "subject" } } diff --git a/app/javascript/dashboard/modules/search/components/SearchResultConversationItem.vue b/app/javascript/dashboard/modules/search/components/SearchResultConversationItem.vue index 179d98c8d..e081be829 100644 --- a/app/javascript/dashboard/modules/search/components/SearchResultConversationItem.vue +++ b/app/javascript/dashboard/modules/search/components/SearchResultConversationItem.vue @@ -35,6 +35,10 @@ const props = defineProps({ type: Number, default: 0, }, + emailSubject: { + type: String, + default: '', + }, }); const navigateTo = computed(() => { @@ -49,6 +53,28 @@ const navigateTo = computed(() => { }); const createdAtTime = dynamicTime(props.createdAt); + +const infoItems = computed(() => [ + { + label: 'SEARCH.FROM', + value: props.name, + show: !!props.name, + }, + { + label: 'SEARCH.EMAIL', + value: props.email, + show: !!props.email, + }, + { + label: 'SEARCH.EMAIL_SUBJECT', + value: props.emailSubject, + show: !!props.emailSubject, + }, +]); + +const visibleInfoItems = computed(() => + infoItems.value.filter(item => item.show) +);