mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-06 22:17:59 +00:00
# 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":  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 <iamsivin@gmail.com>
62 lines
1.5 KiB
Vue
62 lines
1.5 KiB
Vue
<script setup>
|
|
import { defineProps, computed } from 'vue';
|
|
import { useMapGetter } from 'dashboard/composables/store.js';
|
|
import SearchResultSection from './SearchResultSection.vue';
|
|
import SearchResultConversationItem from './SearchResultConversationItem.vue';
|
|
|
|
const props = defineProps({
|
|
conversations: {
|
|
type: Array,
|
|
default: () => [],
|
|
},
|
|
query: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
isFetching: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
showTitle: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
});
|
|
|
|
const accountId = useMapGetter('getCurrentAccountId');
|
|
|
|
const conversationsWithSubject = computed(() => {
|
|
return props.conversations.map(conversation => ({
|
|
...conversation,
|
|
mail_subject: conversation.additional_attributes?.mail_subject || '',
|
|
}));
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<SearchResultSection
|
|
:title="$t('SEARCH.SECTION.CONVERSATIONS')"
|
|
:empty="!conversations.length"
|
|
:query="query"
|
|
:show-title="showTitle"
|
|
:is-fetching="isFetching"
|
|
>
|
|
<ul v-if="conversations.length" class="space-y-1.5 list-none">
|
|
<li
|
|
v-for="conversation in conversationsWithSubject"
|
|
:key="conversation.id"
|
|
>
|
|
<SearchResultConversationItem
|
|
:id="conversation.id"
|
|
:name="conversation.contact.name"
|
|
:email="conversation.contact.email"
|
|
:account-id="accountId"
|
|
:inbox="conversation.inbox"
|
|
:created-at="conversation.created_at"
|
|
:email-subject="conversation.mail_subject"
|
|
/>
|
|
</li>
|
|
</ul>
|
|
</SearchResultSection>
|
|
</template>
|