Feat: Added support changes for contact filters (#3435)

This commit is contained in:
Tejaswini Chile 2021-11-23 16:36:44 +05:30 committed by GitHub
parent 9103fbbdde
commit 11cd7fd6c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 47 deletions

View file

@ -79,54 +79,47 @@
} }
}, },
"contacts": { "contacts": {
"assignee_id": { "name": {
"attribute_name": "Assignee Name", "attribute_name": "Name",
"input_type": "search_box with name tags/plain text", "input_type": "search_box with name tags/plain text",
"data_type": "text", "data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ], "filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ],
"attribute_type": "standard" "attribute_type": "standard"
}, },
"contact_id": { "phone_number": {
"attribute_name": "Contact Name", "attribute_name": "Phone Number",
"input_type": "plain_text", "input_type": "search_box with name tags/plain text",
"data_type": "text", "data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ], "filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ],
"attribute_type": "standard" "attribute_type": "standard"
}, },
"inbox_id": { "email": {
"attribute_name": "Inbox Name", "attribute_name": "Email",
"input_type": "search_box", "input_type": "search_box with name tags/plain text",
"data_type": "text", "data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ], "filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ],
"attribute_type": "standard" "attribute_type": "standard"
}, },
"team_id": { "contact_identifier": {
"attribute_name": "Team Name", "attribute_name": "Contact Identifier",
"input_type": "search_box", "input_type": "search_box with name tags/plain text",
"data_type": "number", "data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ], "filter_operators": [ "equal_to", "not_equal_to" ],
"attribute_type": "standard" "attribute_type": "standard"
}, },
"id": { "country_code": {
"attribute_name": "Conversation Identifier", "attribute_name": "Country",
"input_type": "textbox", "input_type": "textbox",
"data_type": "Number",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ],
"attribute_type": "standard"
},
"campaign_id": {
"attribute_name": "Campaign Name",
"input_type": "textbox",
"data_type": "Number",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "is_present", "is_not_present" ],
"attribute_type": "standard"
},
"labels": {
"attribute_name": "Labels",
"input_type": "tags",
"data_type": "text", "data_type": "text",
"filter_operators": ["exactly_equal_to", "contains", "does_not_contain" ], "filter_operators": [ "equal_to", "not_equal_to" ],
"attribute_type": "standard" "attribute_type": "additional_attributes"
},
"city": {
"attribute_name": "City",
"input_type": "textbox",
"data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ],
"attribute_type": "additional_attributes"
}, },
"browser_language": { "browser_language": {
"attribute_name": "Browser Language", "attribute_name": "Browser Language",
@ -135,19 +128,12 @@
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ], "filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain" ],
"attribute_type": "additional_attributes" "attribute_type": "additional_attributes"
}, },
"country_code": { "labels": {
"attribute_name": "Country Name", "attribute_name": "Labels",
"input_type": "textbox", "input_type": "tags",
"data_type": "text", "data_type": "text",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "present", "is_not_present" ], "filter_operators": ["exactly_equal_to", "contains", "does_not_contain" ],
"attribute_type": "additional_attributes" "attribute_type": "standard"
},
"referer": {
"attribute_name": "Referer link",
"input_type": "textbox",
"data_type": "link",
"filter_operators": [ "equal_to", "not_equal_to", "contains", "does_not_contain", "present", "is_not_present" ],
"attribute_type": "additional_attributes"
} }
} }
} }

View file

@ -26,6 +26,12 @@ describe ::Contacts::FilterService do
attribute_key: 'browser_language', attribute_key: 'browser_language',
filter_operator: 'equal_to', filter_operator: 'equal_to',
values: ['en'], values: ['en'],
query_operator: 'AND'
}.with_indifferent_access,
{
attribute_key: 'name',
filter_operator: 'equal_to',
values: [contact.name],
query_operator: nil query_operator: nil
}.with_indifferent_access }.with_indifferent_access
] ]
@ -37,7 +43,7 @@ describe ::Contacts::FilterService do
expect(result.length).to be 2 expect(result.length).to be 2
end end
it 'filter conversations by tags' do it 'filter contact by tags' do
Contact.last.update_labels('support') Contact.last.update_labels('support')
params[:payload] = [ params[:payload] = [
{ {