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) <noreply@anthropic.com>
This commit is contained in:
parent
4a608a01e8
commit
d120c25917
@ -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"
|
||||
/>
|
||||
|
||||
@ -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"
|
||||
>
|
||||
<span class="i-lucide-triangle-alert text-base flex-shrink-0" />
|
||||
<span>
|
||||
<span v-if="isSuperAdmin">
|
||||
{{ t('GROUP.CREATE.GROUPS_DISABLED') }}
|
||||
<a
|
||||
:href="wootConstants.FAZER_AI_GUIDES_URL"
|
||||
@ -180,6 +181,9 @@ defineExpose({ resetForm });
|
||||
{{ t('GROUP.CREATE.GROUPS_DISABLED_CTA') }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ t('GROUP.CREATE.GROUPS_DISABLED_NON_ADMIN') }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex items-center flex-1 w-full gap-3 px-4 py-3 overflow-y-visible"
|
||||
|
||||
@ -99,6 +99,7 @@ export default {
|
||||
...mapGetters({
|
||||
currentChat: 'getSelectedChat',
|
||||
currentUserId: 'getCurrentUserID',
|
||||
currentUser: 'getCurrentUser',
|
||||
listLoadingStatus: 'getAllMessagesLoaded',
|
||||
currentAccountId: 'getCurrentAccountId',
|
||||
globalConfig: 'globalConfig/get',
|
||||
@ -320,6 +321,9 @@ export default {
|
||||
!this.globalConfig.baileysWhatsappGroupsEnabled
|
||||
);
|
||||
},
|
||||
isSuperAdmin() {
|
||||
return this.currentUser.type === 'SuperAdmin';
|
||||
},
|
||||
inboxProviderConnection() {
|
||||
return this.currentInbox.provider_connection?.connection;
|
||||
},
|
||||
@ -659,7 +663,7 @@ export default {
|
||||
:banner-message="$t('CONVERSATION.ANNOUNCEMENT_MODE_BANNER')"
|
||||
/>
|
||||
<Banner
|
||||
v-if="isGroupsDisabled"
|
||||
v-if="isGroupsDisabled && isSuperAdmin"
|
||||
color-scheme="warning"
|
||||
class="mx-2 mt-2 overflow-hidden rounded-lg"
|
||||
:banner-message="$t('CONVERSATION.GROUPS_DISABLED_BANNER')"
|
||||
@ -667,6 +671,12 @@ export default {
|
||||
:action-button-label="$t('CONVERSATION.GROUPS_DISABLED_CTA')"
|
||||
@primary-action="onOpenGroupsEnabledLink"
|
||||
/>
|
||||
<Banner
|
||||
v-else-if="isGroupsDisabled"
|
||||
color-scheme="warning"
|
||||
class="mx-2 mt-2 overflow-hidden rounded-lg"
|
||||
:banner-message="$t('CONVERSATION.GROUPS_DISABLED_BANNER_NON_ADMIN')"
|
||||
/>
|
||||
<MessageList
|
||||
ref="conversationPanelRef"
|
||||
class="conversation-panel flex-shrink flex-grow basis-px flex flex-col overflow-y-auto relative h-full m-0 pb-4"
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
"ANNOUNCEMENT_MODE_BANNER": "Only administrators are allowed to send messages in this group",
|
||||
"GROUP_LEFT_BANNER": "You are no longer part of this group and cannot send messages in it",
|
||||
"GROUPS_DISABLED_BANNER": "Group messages are disabled. Enable full group support (free) to view and send messages.",
|
||||
"GROUPS_DISABLED_BANNER_NON_ADMIN": "Group messages are disabled. Contact your administrator to enable full group support.",
|
||||
"GROUPS_DISABLED_CTA": "Learn how to enable (free)",
|
||||
"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.",
|
||||
"REPLYING_TO": "You are replying to:",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"SUCCESS_MESSAGE": "Group created successfully.",
|
||||
"ERROR_MESSAGE": "Failed to create group. Please try again.",
|
||||
"GROUPS_DISABLED": "Group creation is disabled. Enable WhatsApp group support (free) to create groups.",
|
||||
"GROUPS_DISABLED_NON_ADMIN": "Group creation is disabled. Contact your administrator to enable WhatsApp group support.",
|
||||
"GROUPS_DISABLED_CTA": "Learn how to enable (free)"
|
||||
},
|
||||
"METADATA": {
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
"ANNOUNCEMENT_MODE_BANNER": "Apenas administradores têm permissão para enviar mensagens neste grupo",
|
||||
"GROUP_LEFT_BANNER": "Você não faz mais parte deste grupo e não pode enviar mensagens nele",
|
||||
"GROUPS_DISABLED_BANNER": "As mensagens de grupo estão desativadas. Ative o suporte completo a grupos (gratuito) para ver e enviar mensagens.",
|
||||
"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.",
|
||||
"GROUPS_DISABLED_CTA": "Saiba como ativar (gratuito)",
|
||||
"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.",
|
||||
"REPLYING_TO": "Você está respondendo a:",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"SUCCESS_MESSAGE": "Grupo criado com sucesso.",
|
||||
"ERROR_MESSAGE": "Falha ao criar grupo. Por favor, tente novamente.",
|
||||
"GROUPS_DISABLED": "A criação de grupos está desativada. Ative o suporte a grupos do WhatsApp (gratuito) para criar grupos.",
|
||||
"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.",
|
||||
"GROUPS_DISABLED_CTA": "Saiba como ativar (gratuito)"
|
||||
},
|
||||
"METADATA": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user