feat: check if label suggestion is enabled in hooks (#13331)

This commit is contained in:
Shivam Mishra
2026-01-21 15:11:41 +05:30
committed by GitHub
parent f84e95ed6c
commit cc5ec833dc
4 changed files with 92 additions and 66 deletions

View File

@@ -2,7 +2,7 @@
import { ref, provide } from 'vue';
// composable
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
import { useCaptain } from 'dashboard/composables/useCaptain';
import { useLabelSuggestions } from 'dashboard/composables/useLabelSuggestions';
import { useSnakeCase } from 'dashboard/composables/useTransformKeys';
// components
@@ -59,7 +59,11 @@ export default {
useKeyboardEvents(keyboardEvents);
const { captainTasksEnabled, getLabelSuggestions } = useCaptain();
const {
captainTasksEnabled,
isLabelSuggestionFeatureEnabled,
getLabelSuggestions,
} = useLabelSuggestions();
provide('contextMenuElementTarget', conversationPanelRef);
@@ -67,6 +71,7 @@ export default {
isPopOutReplyBox,
captainTasksEnabled,
getLabelSuggestions,
isLabelSuggestionFeatureEnabled,
conversationPanelRef,
};
},
@@ -94,7 +99,10 @@ export default {
},
shouldShowLabelSuggestions() {
return (
this.isOpen && this.captainTasksEnabled && !this.messageSentSinceOpened
this.isOpen &&
this.captainTasksEnabled &&
this.isLabelSuggestionFeatureEnabled &&
!this.messageSentSinceOpened
);
},
inboxId() {
@@ -282,7 +290,7 @@ export default {
const existingLabels = this.currentChat?.labels || [];
if (existingLabels.length > 0) return;
if (!this.captainTasksEnabled) {
if (!this.captainTasksEnabled || !this.isLabelSuggestionFeatureEnabled) {
return;
}