From 3f3ee6c34a7f8f69f45c1b259d90abb533bcdfae Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Fri, 10 Jun 2022 18:40:29 +0530 Subject: [PATCH] chore: Add support for message_templates in API inbox (#4835) --- .../widgets/conversation/ReplyBox.vue | 3 ++- .../dashboard/settings/inbox/Settings.vue | 2 -- .../dashboard/store/modules/inboxes.js | 15 +++++++++++-- app/models/channel/api.rb | 19 +++++++++-------- app/models/message.rb | 21 ++++++++++--------- app/views/api/v1/models/_inbox.json.jbuilder | 1 + ...dd_additional_attributes_to_api_channel.rb | 5 +++++ db/schema.rb | 3 ++- 8 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 db/migrate/20220610091206_add_additional_attributes_to_api_channel.rb diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index 22c5ee33c..4df0891e4 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -267,7 +267,8 @@ export default { return false; }, hasWhatsappTemplates() { - return !!this.inbox.message_templates; + return !!this.$store.getters['inboxes/getWhatsAppTemplates'](this.inboxId) + .length; }, enterToSendEnabled() { return !!this.uiSettings.enter_to_send_enabled; diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index 97cd3c294..8c32159f2 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -318,7 +318,6 @@