From d120c2591768c49848a5c1c3d348314baee451ec Mon Sep 17 00:00:00 2001 From: Gabriel Jablonski Date: Sat, 21 Mar 2026 13:01:02 -0300 Subject: [PATCH] fix(groups): restrict enable CTA to superadmin users (#248) Non-superadmin users now see a "contact your administrator" message instead of the "how to enable" action button on group disabled banners. Co-authored-by: Claude Opus 4.6 (1M context) --- .../NewConversation/ComposeConversation.vue | 2 ++ .../components/ComposeNewGroupForm.vue | 6 +++++- .../components/widgets/conversation/MessagesView.vue | 12 +++++++++++- .../dashboard/i18n/locale/en/conversation.json | 1 + app/javascript/dashboard/i18n/locale/en/groups.json | 1 + .../dashboard/i18n/locale/pt_BR/conversation.json | 1 + .../dashboard/i18n/locale/pt_BR/groups.json | 1 + 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue b/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue index 485fe46a4..dbd34800a 100644 --- a/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue +++ b/app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue @@ -104,6 +104,7 @@ const hasGroupInboxes = computed(() => groupCreationInboxes.value.length > 0); const isGroupsDisabled = computed( () => !globalConfig.value.baileysWhatsappGroupsEnabled ); +const isSuperAdmin = computed(() => currentUser.value.type === 'SuperAdmin'); const resetContacts = () => { contacts.value = []; @@ -475,6 +476,7 @@ useKeyboardEvents(keyboardEvents); :inboxes="groupCreationInboxes" :is-creating="groupUiFlags.isCreating" :is-groups-disabled="isGroupsDisabled" + :is-super-admin="isSuperAdmin" @create-group="createGroup" @discard="discardCompose" /> diff --git a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewGroupForm.vue b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewGroupForm.vue index beaedb8f0..93ae63901 100644 --- a/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewGroupForm.vue +++ b/app/javascript/dashboard/components-next/NewConversation/components/ComposeNewGroupForm.vue @@ -13,6 +13,7 @@ const props = defineProps({ inboxes: { type: Array, default: () => [] }, isCreating: { type: Boolean, default: false }, isGroupsDisabled: { type: Boolean, default: false }, + isSuperAdmin: { type: Boolean, default: false }, }); const emit = defineEmits(['createGroup', 'discard']); @@ -169,7 +170,7 @@ defineExpose({ resetForm }); class="flex items-center gap-2 mx-4 mt-3 px-3 py-2 rounded-lg text-sm text-n-amber-11 bg-n-amber-2" > - + {{ t('GROUP.CREATE.GROUPS_DISABLED') }} + + {{ t('GROUP.CREATE.GROUPS_DISABLED_NON_ADMIN') }} +
+