18 Commits

Author SHA1 Message Date
Pranav
a07f2a7c1b feat: Add support for search_conversations in copilot (#11520)
Earlier, we were manually checking if a user was an agent and filtering
their conversations based on inboxes. This logic should have been part
of the conversation permissions service.

This PR moves the check to the right place and updates the logic
accordingly.

Other updates:
- Add support for search_conversations service for copilot.
- Use PermissionFilterService in contacts/conversations, conversations,
copilot search_conversations.

---------

Co-authored-by: Sojan <sojan@pepalo.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-05-20 19:22:17 -07:00
Muhsin Keloth
e0097ab102 chore: Centralize outgoing message reply restrictions for all the channels (#11279) 2025-04-12 08:52:12 +05:30
Sojan Jose
ca83a27e95 chore(refactor): Improve conversation permission filtering (#11166)
1. Add permission filter service to separate permission filtering logic
from conversation queries
2. Implement hierarchical permissions with cleaner logic:
   - conversation_manage gives access to all conversations
- conversation_unassigned_manage gives access to unassigned and user's
conversations
- conversation_participating_manage gives access only to user's
conversations

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
2025-03-31 19:30:02 -07:00
Shivam Mishra
b34dac7bbe feat: validate query conditions (#10595)
Query conditions can take in arbitrary values, this can cause SQL
errors. This PR fixes it
2024-12-17 17:16:37 +05:30
Pranav
f78f278e2f fix: Update validations for filter service (#8239)
- Refactor filter service for better readability and maintenance
- Add validations for the following:
   - If an invalid attribute is passed, a custom exception InvalidAttribute will be thrown.
   - If an invalid operator is passed, a custom exception InvalidOperator will be thrown.
   - If an invalid value (currently checking only null check), a custom exception InvalidValue will be thrown.

Fixes: https://linear.app/chatwoot/issue/CW-2702/activerecordstatementinvalid-pginvalidtextrepresentation-error-invalid
Fixes: https://linear.app/chatwoot/issue/CW-2703/activerecordstatementinvalid-pginvaliddatetimeformat-error-invalid
Fixes:  https://linear.app/chatwoot/issue/CW-2700/activerecordstatementinvalid-pgsyntaxerror-error-syntax-error-at-or


Co-authored-by: Sojan <sojan@pepalo.com>
2024-03-20 16:29:36 +05:30
Pranav Raj S
8c9a351c84 feat: Add support for ascending and descending options in sort (#8542) 2023-12-12 17:15:48 -08:00
Pranav Raj S
3227cf7ff3 fix: Update query to support multiple tag conditions (#8054) 2023-10-05 10:47:42 +05:30
Pranav Raj S
ff915dd2ea fix: Avoid joining tables to fix the distinct value query (#7965)
DISTINCT query with custom attributes return an error. To avoid the error, this PR refactors the query to include tags only when it is required.

Fixes #7931
Fixes #7836

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2023-09-22 19:48:56 -07:00
Tejaswini Chile
afb7e67795 fix: empty account variable for custom_attrbute_definition running in background job (#7351) 2023-06-20 12:15:36 +05:30
Tejaswini Chile
9d0de04f7c fix: set custom filter count in redis (#7164) 2023-06-19 16:10:03 +05:30
Shivam Mishra
958c0d7946 feat(perf): improve performance of conversation filter API [CW-1605] (#7120)
* feat(perf): don't use count

* feat(perf): include messages in the conversation query

* feat: include contact inboxes

* refactor: use blank?
2023-05-22 16:03:11 +05:30
Shivam Mishra
a34729c153 feat: add activity message for priority change (#6933)
* feat: add priority const

* feat: add toggle priority method

* feat: update controller route and specs

* refactor: status change method

* refactor: abstract label change and mute activity

* feat: add priority change_activity

* fix: interpolation for previous_changes

* refactor: reduce cognitive complexity of priority_change_activity

* refactor: move priority activity message handler to a separate module

* refactor: move typing logic to a service

* refactor: tests to reduce complexity

* fix: typo

* fix: constants

* fix: priority conditions

* fix: add a response

* fix: argument destructuring in I18n.t

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2023-04-20 16:41:53 +05:30
Tejaswini Chile
aa903a5da9 Fix: backend changes for custom attribute (#4830) 2022-06-13 11:58:54 +05:30
Tejaswini Chile
3158966241 Feat: automation rule based on contact conditions (#4230) 2022-03-29 17:29:34 +05:30
Tejaswini Chile
a7987d4d1c feat: Add date custom filter (#3892) 2022-02-04 13:14:20 +05:30
Tejaswini Chile
a95d249ec1 Feat: Custom attribute advanced filter (#3818) 2022-01-31 13:36:44 +05:30
Tejaswini Chile
7b44bf5b78 Fix: Filter with label name (#3418) 2021-11-19 13:55:40 +05:30
Tejaswini Chile
372bd75028 feat: Add filter APIs for Contacts and Conversations (#3264) 2021-11-01 12:27:04 +04:00