lib/bobot/page.rb in bobot-4.8.0 vs lib/bobot/page.rb in bobot-4.9.0

- old
+ new

@@ -324,11 +324,11 @@ greeting_texts << { locale: 'default', text: greeting_text } if greeting_text.present? # Each languages I18n.available_locales.each do |locale| greeting_text = I18n.t("bobot.#{slug}.config.greeting_text", locale: locale, default: nil) next unless greeting_text.present? - facebook_locales = I18n.t("bobot.#{slug}.config.facebook_locales", locale: locale, default: nil) + facebook_locales = I18n.t("bobot.#{slug}.config.facebook_locales", locale: locale, default: []) facebook_locales.to_a.each do |locale_long| greeting_texts << { locale: locale_long, text: greeting_text } end end else @@ -426,12 +426,12 @@ raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present? persistent_menus = [] # Default text if language.nil? short_slug = slug.gsub(/_\w+$/, "") - persistent_menu = I18n.t("bobot.#{slug}.config.persistent_menu", locale: I18n.default_locale, default: nil) - persistent_menu = I18n.t("bobot.#{short_slug}.config.persistent_menu", locale: I18n.default_locale, default: nil) if persistent_menu.nil? + persistent_menu = I18n.t("bobot.#{slug}.config.persistent_menu", locale: I18n.default_locale, default: {}) + persistent_menu = I18n.t("bobot.#{short_slug}.config.persistent_menu", locale: I18n.default_locale, default: {}) unless persistent_menu.present? if persistent_menu.present? persistent_menus << { locale: 'default', composer_input_disabled: persistent_menu[:composer_input_disabled], call_to_actions: persistent_menu[:call_to_actions], @@ -439,12 +439,12 @@ end # Each languages I18n.available_locales.each do |locale| persistent_menu = I18n.t("bobot.#{slug}.config.persistent_menu", locale: locale, default: nil) persistent_menu = I18n.t("bobot.#{short_slug}.config.persistent_menu", locale: locale, default: nil) if persistent_menu.nil? - facebook_locales = I18n.t("bobot.#{slug}.config.facebook_locales", locale: locale, default: nil) - facebook_locales = I18n.t("bobot.#{short_slug}.config.facebook_locales", locale: locale, default: nil) if facebook_locales.nil? + facebook_locales = I18n.t("bobot.#{slug}.config.facebook_locales", locale: locale, default: []) + facebook_locales = I18n.t("bobot.#{short_slug}.config.facebook_locales", locale: locale, default: []) unless facebook_locales.present? next unless persistent_menu.present? facebook_locales.to_a.each do |locale_long| persistent_menus << { locale: locale_long, composer_input_disabled: persistent_menu[:composer_input_disabled], @@ -452,11 +452,11 @@ } end end else short_slug = slug.gsub(/_#{language}$/, "") - persistent_menu = I18n.t("bobot.#{slug}.config.persistent_menu", locale: language, default: nil) - persistent_menu = I18n.t("bobot.#{short_slug}.config.persistent_menu", locale: language, default: nil) if persistent_menu.nil? + persistent_menu = I18n.t("bobot.#{slug}.config.persistent_menu", locale: language, default: {}) + persistent_menu = I18n.t("bobot.#{short_slug}.config.persistent_menu", locale: language, default: {}) unless persistent_menu.present? if persistent_menu.present? persistent_menus << { locale: 'default', composer_input_disabled: persistent_menu[:composer_input_disabled], call_to_actions: persistent_menu[:call_to_actions],