@@ -6,6 +6,7 @@ import { useTrack } from 'dashboard/composables';
66import { emitter } from ' shared/helpers/mitt' ;
77import { useI18n } from ' vue-i18n' ;
88import { useRoute } from ' vue-router' ;
9+ import { useStore } from ' vuex' ;
910import { LocalStorage } from ' shared/helpers/localStorage' ;
1011import { ACCOUNT_EVENTS } from ' dashboard/helper/AnalyticsHelper/events' ;
1112import { LOCAL_STORAGE_KEYS } from ' dashboard/constants/localStorage' ;
@@ -335,10 +336,24 @@ const payloadForContextMenu = computed(() => {
335336 };
336337});
337338
339+ const store = useStore ();
340+ const currentRole = computed (() => store .getters .getCurrentRole );
341+ const accountId = computed (() => store .getters .getCurrentAccountId );
342+ const isFeatureEnabledonAccount = computed (
343+ () => store .getters [' accounts/isFeatureEnabledonAccount' ]
344+ );
345+
338346const contextMenuEnabledOptions = computed (() => {
339347 const hasText = !! props .content ;
340348 const hasAttachments = !! (props .attachments && props .attachments .length > 0 );
341349
350+ const hideDeleteMessageForAgents =
351+ currentRole .value !== ' administrator' &&
352+ isFeatureEnabledonAccount .value (
353+ accountId .value ,
354+ ' hide_delete_message_for_agent'
355+ );
356+
342357 const isOutgoing = props .messageType === MESSAGE_TYPES .OUTGOING ;
343358 const isFailedOrProcessing =
344359 props .status === MESSAGE_STATUS .FAILED ||
@@ -347,6 +362,7 @@ const contextMenuEnabledOptions = computed(() => {
347362 return {
348363 copy: hasText,
349364 delete:
365+ ! hideDeleteMessageForAgents &&
350366 (hasText || hasAttachments) &&
351367 ! isFailedOrProcessing &&
352368 ! isMessageDeleted .value ,
0 commit comments