From dc6757df3d4693d691fc70c3f21179f4361043b5 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 5 Oct 2023 11:28:05 +0530 Subject: [PATCH] refactor: use feature flag to toggle reply to --- .../components/widgets/conversation/Message.vue | 3 +-- .../components/widgets/conversation/MessagesView.vue | 11 ++++++++++- app/javascript/dashboard/featureFlags.js | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index 3192a3819..4b374c16d 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -274,8 +274,7 @@ export default { copy: this.hasText, delete: this.hasText || this.hasAttachments, cannedResponse: this.isOutgoing && this.hasText, - replyTo: false, - // replyTo: !this.data.private && this.inboxSupportsReplyTo, + replyTo: !this.data.private && this.inboxSupportsReplyTo, }; }, contentAttributes() { diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index f33230055..d58742401 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -124,6 +124,7 @@ import { LocalStorage } from 'shared/helpers/localStorage'; // constants import { BUS_EVENTS } from 'shared/constants/busEvents'; +import { FEATURE_FLAGS } from 'dashboard/featureFlags'; import { REPLY_POLICY } from 'shared/constants/links'; import wootConstants from 'dashboard/constants/globals'; import { LOCAL_STORAGE_KEYS } from 'dashboard/constants/localStorage'; @@ -165,12 +166,14 @@ export default { computed: { ...mapGetters({ + accountId: 'getCurrentAccountId', currentChat: 'getSelectedChat', allConversations: 'getAllConversations', inboxesList: 'inboxes/getInboxes', listLoadingStatus: 'getAllMessagesLoaded', loadingChatList: 'getChatListLoadingStatus', appIntegrations: 'integrations/getAppIntegrations', + isFeatureEnabledonAccount: 'accounts/isFeatureEnabledonAccount', currentAccountId: 'getCurrentAccountId', }), isOpen() { @@ -318,7 +321,13 @@ export default { return this.currentChat.unread_count || 0; }, inboxSupportsReplyTo() { - return this.inboxHasFeature(INBOX_FEATURES.REPLY_TO); + return ( + this.inboxHasFeature(INBOX_FEATURES.REPLY_TO) && + this.isFeatureEnabledonAccount( + this.accountId, + FEATURE_FLAGS.MESSAGE_REPLY_TO + ) + ); }, }, diff --git a/app/javascript/dashboard/featureFlags.js b/app/javascript/dashboard/featureFlags.js index 5f3a9ccbd..0da932e30 100644 --- a/app/javascript/dashboard/featureFlags.js +++ b/app/javascript/dashboard/featureFlags.js @@ -16,4 +16,5 @@ export const FEATURE_FLAGS = { TEAM_MANAGEMENT: 'team_management', VOICE_RECORDER: 'voice_recorder', AUDIT_LOGS: 'audit_logs', + MESSAGE_REPLY_TO: 'message_reply_to', };