# Pull Request Template ## Description Adds a Contact condition to the conversation advanced filter so agents can search for an existing contact and filter conversations by `conversations.contact_id`. Fixes [CW-7239](https://linear.app/chatwoot/issue/CW-7239/contact-filter-for-conversations) ## Type of change - [ ] 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? - `eval "$(rbenv init -)" && bundle exec rspec spec/services/conversations/filter_service_spec.rb` - `pnpm exec vitest --no-watch --no-cache --no-coverage --logHeapUsage app/javascript/dashboard/components-next/filter/helper/filterHelper.spec.js app/javascript/dashboard/store/modules/conversations/helpers/specs/filterHelpers.spec.js app/javascript/dashboard/helper/specs/customViewsHelper.spec.js app/javascript/dashboard/helper/specs/filterQueryGenerator.spec.js` - `pnpm eslint` - `eval "$(rbenv init -)" && bundle exec rubocop spec/services/conversations/filter_service_spec.rb` ## 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 --------- Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
97 lines
1.9 KiB
JavaScript
97 lines
1.9 KiB
JavaScript
export const contactViewList = [
|
|
{
|
|
name: 'Custom view 1',
|
|
filter_type: 1,
|
|
query: {
|
|
payload: [
|
|
{
|
|
attribute_key: 'name',
|
|
filter_operator: 'equal_to',
|
|
values: ['john doe'],
|
|
query_operator: null,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|
|
|
|
export const contactFilterView = {
|
|
name: 'Contact view',
|
|
filter_type: 0,
|
|
query: {
|
|
payload: [
|
|
{
|
|
attribute_key: 'contact_id',
|
|
filter_operator: 'equal_to',
|
|
values: [42],
|
|
query_operator: null,
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
export const customViewList = [
|
|
{
|
|
name: 'Custom view',
|
|
filter_type: 0,
|
|
query: {
|
|
payload: [
|
|
{
|
|
attribute_key: 'assignee_id',
|
|
filter_operator: 'equal_to',
|
|
values: [45],
|
|
query_operator: 'and',
|
|
},
|
|
{
|
|
attribute_key: 'inbox_id',
|
|
filter_operator: 'equal_to',
|
|
values: [144],
|
|
query_operator: 'and',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
name: 'Custom view 1',
|
|
filter_type: 0,
|
|
query: {
|
|
payload: [
|
|
{
|
|
attribute_key: 'assignee_id',
|
|
filter_operator: 'equal_to',
|
|
values: [45],
|
|
query_operator: 'and',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|
|
|
|
export const updateCustomViewList = [
|
|
{
|
|
id: 1,
|
|
name: 'Open',
|
|
filter_type: 'conversation',
|
|
query: {
|
|
payload: [
|
|
{
|
|
attribute_key: 'status',
|
|
attribute_model: 'standard',
|
|
filter_operator: 'equal_to',
|
|
values: ['open'],
|
|
query_operator: 'and',
|
|
custom_attribute_type: '',
|
|
},
|
|
{
|
|
attribute_key: 'assignee_id',
|
|
filter_operator: 'equal_to',
|
|
values: [52],
|
|
custom_attribute_type: '',
|
|
},
|
|
],
|
|
},
|
|
created_at: '2022-02-08T03:17:38.761Z',
|
|
updated_at: '2023-06-05T13:57:48.478Z',
|
|
},
|
|
];
|