From e3193dcabc9dbeb690b882de6cac00a717e2eedc Mon Sep 17 00:00:00 2001 From: Tejaswini Chile Date: Mon, 24 Apr 2023 12:49:52 +0530 Subject: [PATCH] feat: Link help center portal to an Inbox (#6903) --- .../api/v1/accounts/inboxes_controller.rb | 5 ++- .../dashboard/i18n/locale/en/inboxMgmt.json | 7 ++++ .../dashboard/settings/inbox/Settings.vue | 32 ++++++++++++++++++- app/models/inbox.rb | 7 ++++ app/models/portal.rb | 1 + app/views/api/v1/models/_inbox.json.jbuilder | 7 ++++ .../20230413085302_add_portal_id_to_inbox.rb | 5 +++ db/schema.rb | 3 ++ .../v1/accounts/inboxes_controller_spec.rb | 4 ++- spec/models/inbox_spec.rb | 8 +++++ spec/models/portal_spec.rb | 1 + 11 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20230413085302_add_portal_id_to_inbox.rb diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb index 20402b5d1..9b5cafc4c 100644 --- a/app/controllers/api/v1/accounts/inboxes_controller.rb +++ b/app/controllers/api/v1/accounts/inboxes_controller.rb @@ -114,10 +114,13 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController def inbox_attributes [:name, :avatar, :greeting_enabled, :greeting_message, :enable_email_collect, :csat_survey_enabled, :enable_auto_assignment, :working_hours_enabled, :out_of_office_message, :timezone, :allow_messages_after_resolved, - :lock_to_single_conversation] + :lock_to_single_conversation, :portal_id] end def permitted_params(channel_attributes = []) + # We will remove this line after fixing https://linear.app/chatwoot/issue/CW-1567/null-value-passed-as-null-string-to-backend + params.each { |k, v| params[k] = params[k] == 'null' ? nil : v } + params.permit( *inbox_attributes, channel: [:type, *channel_attributes] diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 14f60eac8..97a4ee2f6 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -482,6 +482,13 @@ "WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.", "UPDATE_PRE_CHAT_FORM_SETTINGS": "Update Pre Chat Form Settings" }, + "HELP_CENTER": { + "LABEL": "Help Center", + "PLACEHOLDER": "Select Help Center", + "SELECT_PLACEHOLDER": "Select Help Center", + "REMOVE": "Remove Help Center", + "SUB_TEXT": "Attach a Help Center with the inbox" + }, "AUTO_ASSIGNMENT": { "MAX_ASSIGNMENT_LIMIT": "Auto assignment limit", "MAX_ASSIGNMENT_LIMIT_RANGE_ERROR": "Please enter a value greater than 0", diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index ebee9474d..5e1e55cff 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -258,7 +258,22 @@ }}

- +
+ + +

+ {{ $t('INBOX_MGMT.HELP_CENTER.SUB_TEXT') }} +

+