feat: Adds the ability to have custom view for conversations (#3666)

* feat: Adds the ability to save custom filters and display folders on the sidebar

* Minor fixes

* Review fixes

* Review fixes

* i18n fixes

* Shows conversations when the user click on the folder sidebar item

* Spacing fixes

* Review fixes

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Sivin Varghese
2022-01-17 09:18:54 +05:30
committed by GitHub
parent 290196d43b
commit 4398734bdf
21 changed files with 594 additions and 23 deletions

View File

@@ -0,0 +1,65 @@
import { getters } from '../../customViews';
import customViewList from './fixtures';
describe('#getters', () => {
it('getCustomViews', () => {
const state = { records: customViewList };
expect(getters.getCustomViews(state)).toEqual([
{
name: 'Custom view',
filter_type: 'conversation',
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: 'conversation',
query: {
payload: [
{
attribute_key: 'browser_language',
filter_operator: 'equal_to',
values: ['eng'],
query_operator: 'or',
},
{
attribute_key: 'campaign_id',
filter_operator: 'equal_to',
values: [15],
query_operator: 'and',
},
],
},
},
]);
});
it('getUIFlags', () => {
const state = {
uiFlags: {
isFetching: true,
isCreating: false,
isDeleting: false,
},
};
expect(getters.getUIFlags(state)).toEqual({
isFetching: true,
isCreating: false,
isDeleting: false,
});
});
});