iachat/app/models/concerns
Gabriel Jablonski 5cc78c7b33
feat(super-admin): hide assignee tabs for basic agents (#279)
* fix(featurable): backport feature_flag_value helper from chatwoot-pro-main

Adds the two's-complement-aware helper that returns a signed bigint-safe
value for SQL queries against the feature_flags column. Mirrors the
existing helper in chatwoot-pro-main so future backports of pro features
that reference it (e.g. kanban filters) compile cleanly on main.

Note: the helper does NOT fix FlagShihTzu's write path; new account-level
toggles should use account.settings jsonb instead of feature_flags
(see AGENTS.md).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(super-admin): toggle to hide assignee tabs for basic agents

Adds two account-level settings, configurable from the super admin
dashboard, that hide the "Unassigned" and "All" tabs of the conversation
list for users with the basic agent role (admins and custom roles are
unaffected). Hiding "Unassigned" implicitly hides "All", since seeing
the full queue without the unassigned subset is incoherent. The
constraint is enforced both in the backend (before_validation forces
hide_agent_all_tab=true when hide_agent_unassigned_tab is on) and in
the super admin form (the "All" checkbox is disabled and auto-checked
when "Unassigned" is checked).

Storage uses account.settings (jsonb) instead of feature_flags to
sidestep the bigint bit-position overflow that happens once features.yml
crosses 64 entries, and to keep keys stable across the main and
chatwoot-pro-main forks where feature bit positions diverge. AGENTS.md
documents the rationale and the recipe to add future toggles.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(chat-list): guard activeAssigneeTabCount against missing tab

When the visibility settings hide the currently selected tab, the
fallback watch resets activeAssigneeTab to ME, but activeAssigneeTabCount
re-evaluates in the same reactive cycle and can read .count on undefined
before the watch flushes. Use optional chaining + nullish fallback so
the count safely returns 0 during the brief inconsistency.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 16:25:45 -03:00
..
.keep Initial Commit 2019-08-14 15:18:44 +05:30
access_tokenable.rb Chore: Replaced dependent destroy with dependent destroy_async in all models (#3249) 2021-11-18 10:32:29 +05:30
account_cache_revalidator.rb feat: expiry for cache keys [CW-3038] (#8793) 2024-01-29 15:27:26 +05:30
account_captain_auto_resolve.rb feat: Add force legacy auto-resolve flag (#13804) 2026-03-13 15:04:58 -07:00
account_email_rate_limitable.rb fix: Skip email rate limiting for self-hosted instances (#13915) 2026-03-26 18:06:10 +05:30
account_settings_schema.rb feat(super-admin): hide assignee tabs for basic agents (#279) 2026-04-30 16:25:45 -03:00
activity_message_handler.rb feat: show assignment policy name in auto-assignment activity messages (#13598) 2026-02-24 13:32:54 +05:30
assignee_activity_message_handler.rb feat: show assignment policy name in auto-assignment activity messages (#13598) 2026-02-24 13:32:54 +05:30
assignment_handler.rb feat: Add support for multi-language support for Captain (#11068) 2025-03-19 18:25:33 -07:00
auto_assignment_handler.rb feat: trigger assignment on resolve (#13780) 2026-03-16 13:13:37 +05:30
availability_statusable.rb chore: Move agent availability to Account level (#3074) 2021-10-07 13:21:46 +05:30
avatarable.rb chore: Upgrade to Rails 7 (#6719) 2023-05-06 10:44:52 +05:30
cache_keys.rb feat: baileys provider for whatsapp (#7) 2025-04-03 23:28:38 -03:00
captain_featurable.rb feat: add global config for captain settings (#13141) 2026-01-12 19:54:19 +05:30
channelable.rb chore: Centralize outgoing message reply restrictions for all the channels (#11279) 2025-04-12 08:52:12 +05:30
content_attribute_validator.rb chore: lint files (#2) 2025-04-03 23:28:38 -03:00
conversation_mute_helpers.rb Merge branch 'main' into chore/merge-upstream-4.10 2026-01-16 14:01:53 -03:00
email_address_parseable.rb fix: validate support_email format and handle parse errors in mailer (#13958) 2026-04-13 19:06:06 +07:00
featurable.rb feat(super-admin): hide assignee tabs for basic agents (#279) 2026-04-30 16:25:45 -03:00
group_conversation_handler.rb feat: group conversations (#228) 2026-03-19 21:56:58 -03:00
inbox_agent_availability.rb Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
json_schema_validator.rb feat: Add support for minutes in auto resolve feature (#11269) 2025-05-07 00:36:15 -07:00
label_activity_message_handler.rb feat: add activity message for SLA (#9100) 2024-03-13 20:05:34 +05:30
labelable.rb feat: Add support for labels in automations (#11658) 2025-09-18 14:17:54 +05:30
liquidable.rb feat: Add liquid template support for WhatsApp template parameters (#12227) 2025-08-21 16:44:51 +05:30
llm_formattable.rb chore: Update LLM formatter classes to include additional details (#11491) 2025-05-15 17:47:37 -07:00
message_filter_helpers.rb fix: Skip notifications for private notes (#13617) 2026-02-23 15:40:54 +04:00
out_of_offisable.rb Fix: add option to choose 24 hour working slot (#4018) 2022-02-22 01:28:49 -08:00
priority_activity_message_handler.rb chore(i18n): Improvements in automation and macros (#11231) 2025-04-02 15:48:42 -07:00
pubsubable.rb chore: Rotate pubsub token on password change (#7194) 2023-05-27 13:24:31 +05:30
push_data_helper.rb fix: strip markdown hard-break backslashes from webhook payloads (#13950) 2026-04-16 13:19:35 +05:30
reauthorizable.rb fix: call authorization_error! on IMAP auth failures (#13560) (revert) (#13671) 2026-02-26 18:45:18 -08:00
reportable.rb Chore: clean up Reporting Events (#4044) 2022-02-28 18:16:12 +05:30
scheduled_message_handler.rb feat: mensagens agendadas (#198) 2026-01-30 22:08:16 -03:00
sla_activity_message_handler.rb feat: add activity message for SLA (#9100) 2024-03-13 20:05:34 +05:30
sort_handler.rb feat: Add a priority + created at sort for conversations (#13658) 2026-02-25 18:22:41 -08:00
sso_authenticatable.rb feat: Prevent saving preferences and status when impersonating (#11164) 2025-05-20 17:34:30 -07:00
team_activity_message_handler.rb feat: add activity message for SLA (#9100) 2024-03-13 20:05:34 +05:30
user_attribute_helpers.rb chore: Account switching issue in newly added accounts (#12403) 2025-09-10 14:12:22 +05:30
webhook_secretable.rb feat: sign webhooks for API channel and agentbots (#13892) 2026-04-06 15:28:25 +05:30