From ee2189d98a13dfd8adfc2160f8056aadfaa754ce Mon Sep 17 00:00:00 2001 From: Tejaswini Chile Date: Thu, 1 Sep 2022 16:44:06 +0530 Subject: [PATCH] fix: Set and Update portal's default locale (#5368) --- app/controllers/api/v1/accounts/portals_controller.rb | 3 ++- app/models/portal.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/accounts/portals_controller.rb b/app/controllers/api/v1/accounts/portals_controller.rb index c3d8ad024..6ac000b58 100644 --- a/app/controllers/api/v1/accounts/portals_controller.rb +++ b/app/controllers/api/v1/accounts/portals_controller.rb @@ -58,7 +58,8 @@ class Api::V1::Accounts::PortalsController < Api::V1::Accounts::BaseController def portal_params params.require(:portal).permit( - :account_id, :color, :custom_domain, :header_text, :homepage_link, :name, :page_title, :slug, :archived, config: { allowed_locales: [] } + :account_id, :color, :custom_domain, :header_text, :homepage_link, :name, :page_title, :slug, :archived, { config: [:default_locale, + { allowed_locales: [] }] } ) end diff --git a/app/models/portal.rb b/app/models/portal.rb index e37a5992d..ca7b0b3f0 100644 --- a/app/models/portal.rb +++ b/app/models/portal.rb @@ -67,7 +67,7 @@ class Portal < ApplicationRecord private def config_json_format - config['default_locale'] = 'en' + config['default_locale'] = default_locale denied_keys = config.keys - CONFIG_JSON_KEYS errors.add(:cofig, "in portal on #{denied_keys.join(',')} is not supported.") if denied_keys.any? end