Skip to content

Commit e0271a3

Browse files
fix(groups): restrict enable CTA to superadmin users
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) <noreply@anthropic.com>
1 parent 4a608a0 commit e0271a3

File tree

7 files changed

+22
-2
lines changed

7 files changed

+22
-2
lines changed

app/javascript/dashboard/components-next/NewConversation/ComposeConversation.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const hasGroupInboxes = computed(() => groupCreationInboxes.value.length > 0);
104104
const isGroupsDisabled = computed(
105105
() => !globalConfig.value.baileysWhatsappGroupsEnabled
106106
);
107+
const isSuperAdmin = computed(() => currentUser.value.type === 'SuperAdmin');
107108
108109
const resetContacts = () => {
109110
contacts.value = [];
@@ -475,6 +476,7 @@ useKeyboardEvents(keyboardEvents);
475476
:inboxes="groupCreationInboxes"
476477
:is-creating="groupUiFlags.isCreating"
477478
:is-groups-disabled="isGroupsDisabled"
479+
:is-super-admin="isSuperAdmin"
478480
@create-group="createGroup"
479481
@discard="discardCompose"
480482
/>

app/javascript/dashboard/components-next/NewConversation/components/ComposeNewGroupForm.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const props = defineProps({
1313
inboxes: { type: Array, default: () => [] },
1414
isCreating: { type: Boolean, default: false },
1515
isGroupsDisabled: { type: Boolean, default: false },
16+
isSuperAdmin: { type: Boolean, default: false },
1617
});
1718
1819
const emit = defineEmits(['createGroup', 'discard']);
@@ -169,7 +170,7 @@ defineExpose({ resetForm });
169170
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"
170171
>
171172
<span class="i-lucide-triangle-alert text-base flex-shrink-0" />
172-
<span>
173+
<span v-if="isSuperAdmin">
173174
{{ t('GROUP.CREATE.GROUPS_DISABLED') }}
174175
<a
175176
:href="wootConstants.FAZER_AI_GUIDES_URL"
@@ -180,6 +181,9 @@ defineExpose({ resetForm });
180181
{{ t('GROUP.CREATE.GROUPS_DISABLED_CTA') }}
181182
</a>
182183
</span>
184+
<span v-else>
185+
{{ t('GROUP.CREATE.GROUPS_DISABLED_NON_ADMIN') }}
186+
</span>
183187
</div>
184188
<div
185189
class="flex items-center flex-1 w-full gap-3 px-4 py-3 overflow-y-visible"

app/javascript/dashboard/components/widgets/conversation/MessagesView.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default {
9999
...mapGetters({
100100
currentChat: 'getSelectedChat',
101101
currentUserId: 'getCurrentUserID',
102+
currentUser: 'getCurrentUser',
102103
listLoadingStatus: 'getAllMessagesLoaded',
103104
currentAccountId: 'getCurrentAccountId',
104105
globalConfig: 'globalConfig/get',
@@ -320,6 +321,9 @@ export default {
320321
!this.globalConfig.baileysWhatsappGroupsEnabled
321322
);
322323
},
324+
isSuperAdmin() {
325+
return this.currentUser.type === 'SuperAdmin';
326+
},
323327
inboxProviderConnection() {
324328
return this.currentInbox.provider_connection?.connection;
325329
},
@@ -659,14 +663,20 @@ export default {
659663
:banner-message="$t('CONVERSATION.ANNOUNCEMENT_MODE_BANNER')"
660664
/>
661665
<Banner
662-
v-if="isGroupsDisabled"
666+
v-if="isGroupsDisabled && isSuperAdmin"
663667
color-scheme="warning"
664668
class="mx-2 mt-2 overflow-hidden rounded-lg"
665669
:banner-message="$t('CONVERSATION.GROUPS_DISABLED_BANNER')"
666670
has-action-button
667671
:action-button-label="$t('CONVERSATION.GROUPS_DISABLED_CTA')"
668672
@primary-action="onOpenGroupsEnabledLink"
669673
/>
674+
<Banner
675+
v-else-if="isGroupsDisabled"
676+
color-scheme="warning"
677+
class="mx-2 mt-2 overflow-hidden rounded-lg"
678+
:banner-message="$t('CONVERSATION.GROUPS_DISABLED_BANNER_NON_ADMIN')"
679+
/>
670680
<MessageList
671681
ref="conversationPanelRef"
672682
class="conversation-panel flex-shrink flex-grow basis-px flex flex-col overflow-y-auto relative h-full m-0 pb-4"

app/javascript/dashboard/i18n/locale/en/conversation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"ANNOUNCEMENT_MODE_BANNER": "Only administrators are allowed to send messages in this group",
4747
"GROUP_LEFT_BANNER": "You are no longer part of this group and cannot send messages in it",
4848
"GROUPS_DISABLED_BANNER": "Group messages are disabled. Enable full group support (free) to view and send messages.",
49+
"GROUPS_DISABLED_BANNER_NON_ADMIN": "Group messages are disabled. Contact your administrator to enable full group support.",
4950
"GROUPS_DISABLED_CTA": "Learn how to enable (free)",
5051
"OLD_INSTAGRAM_INBOX_REPLY_BANNER": "This Instagram account was migrated to the new Instagram channel inbox. All new messages will show up there. You won’t be able to send messages from this conversation anymore.",
5152
"REPLYING_TO": "You are replying to:",

app/javascript/dashboard/i18n/locale/en/groups.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"SUCCESS_MESSAGE": "Group created successfully.",
3333
"ERROR_MESSAGE": "Failed to create group. Please try again.",
3434
"GROUPS_DISABLED": "Group creation is disabled. Enable WhatsApp group support (free) to create groups.",
35+
"GROUPS_DISABLED_NON_ADMIN": "Group creation is disabled. Contact your administrator to enable WhatsApp group support.",
3536
"GROUPS_DISABLED_CTA": "Learn how to enable (free)"
3637
},
3738
"METADATA": {

app/javascript/dashboard/i18n/locale/pt_BR/conversation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"ANNOUNCEMENT_MODE_BANNER": "Apenas administradores têm permissão para enviar mensagens neste grupo",
4747
"GROUP_LEFT_BANNER": "Você não faz mais parte deste grupo e não pode enviar mensagens nele",
4848
"GROUPS_DISABLED_BANNER": "As mensagens de grupo estão desativadas. Ative o suporte completo a grupos (gratuito) para ver e enviar mensagens.",
49+
"GROUPS_DISABLED_BANNER_NON_ADMIN": "As mensagens de grupo estão desativadas. Entre em contato com o administrador para ativar o suporte completo a grupos.",
4950
"GROUPS_DISABLED_CTA": "Saiba como ativar (gratuito)",
5051
"OLD_INSTAGRAM_INBOX_REPLY_BANNER": "Esta conta do Instagram foi migrada para a nova caixa de entrada do canal do Instagram. Todas as novas mensagens serão mostradas lá. Você não poderá mais enviar mensagens desta conversa.",
5152
"REPLYING_TO": "Você está respondendo a:",

app/javascript/dashboard/i18n/locale/pt_BR/groups.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"SUCCESS_MESSAGE": "Grupo criado com sucesso.",
3333
"ERROR_MESSAGE": "Falha ao criar grupo. Por favor, tente novamente.",
3434
"GROUPS_DISABLED": "A criação de grupos está desativada. Ative o suporte a grupos do WhatsApp (gratuito) para criar grupos.",
35+
"GROUPS_DISABLED_NON_ADMIN": "A criação de grupos está desativada. Entre em contato com o administrador para ativar o suporte a grupos do WhatsApp.",
3536
"GROUPS_DISABLED_CTA": "Saiba como ativar (gratuito)"
3637
},
3738
"METADATA": {

0 commit comments

Comments
 (0)