chore: Update dependencies to the latest versions (#5033)
This commit is contained in:
@@ -112,7 +112,7 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def support_email
|
||||
super || ENV['MAILER_SENDER_EMAIL'] || GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL']
|
||||
super || ENV.fetch('MAILER_SENDER_EMAIL') { GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL'] }
|
||||
end
|
||||
|
||||
def usage_limits
|
||||
|
||||
@@ -63,7 +63,7 @@ class Category < ApplicationRecord
|
||||
validates :name, presence: true
|
||||
validate :allowed_locales
|
||||
validates :locale, uniqueness: { scope: %i[slug portal_id],
|
||||
message: 'should be unique in the category and portal' }
|
||||
message: I18n.t('errors.categories.locale.unique') }
|
||||
accepts_nested_attributes_for :related_categories
|
||||
|
||||
scope :search_by_locale, ->(locale) { where(locale: locale) if locale.present? }
|
||||
|
||||
@@ -72,7 +72,7 @@ class Channel::Telegram < ApplicationRecord
|
||||
HTTParty.post("#{telegram_api_url}/deleteWebhook")
|
||||
response = HTTParty.post("#{telegram_api_url}/setWebhook",
|
||||
body: {
|
||||
url: "#{ENV['FRONTEND_URL']}/webhooks/telegram/#{bot_token}"
|
||||
url: "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/telegram/#{bot_token}"
|
||||
})
|
||||
errors.add(:bot_token, 'error setting up the webook') unless response.success?
|
||||
end
|
||||
|
||||
@@ -29,11 +29,11 @@ class Contact < ApplicationRecord
|
||||
|
||||
validates :account_id, presence: true
|
||||
validates :email, allow_blank: true, uniqueness: { scope: [:account_id], case_sensitive: false },
|
||||
format: { with: Devise.email_regexp, message: 'Invalid email' }
|
||||
format: { with: Devise.email_regexp, message: I18n.t('errors.contacts.email.invalid') }
|
||||
validates :identifier, allow_blank: true, uniqueness: { scope: [:account_id] }
|
||||
validates :phone_number,
|
||||
allow_blank: true, uniqueness: { scope: [:account_id] },
|
||||
format: { with: /\+[1-9]\d{1,14}\z/, message: 'Should be in e164 format' }
|
||||
format: { with: /\+[1-9]\d{1,14}\z/, message: I18n.t('errors.contacts.phone_number.invalid') }
|
||||
validates :name, length: { maximum: 255 }
|
||||
|
||||
belongs_to :account
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#
|
||||
class DataImport < ApplicationRecord
|
||||
belongs_to :account
|
||||
validates :data_type, inclusion: { in: ['contacts'], message: '%<value>s is an invalid data type' }
|
||||
validates :data_type, inclusion: { in: ['contacts'], message: I18n.t('errors.data_import.data_type.invalid') }
|
||||
enum status: { pending: 0, processing: 1, completed: 2, failed: 3 }
|
||||
|
||||
has_one_attached :import_file
|
||||
|
||||
@@ -115,13 +115,13 @@ class Inbox < ApplicationRecord
|
||||
def callback_webhook_url
|
||||
case channel_type
|
||||
when 'Channel::TwilioSms'
|
||||
"#{ENV['FRONTEND_URL']}/twilio/callback"
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/twilio/callback"
|
||||
when 'Channel::Sms'
|
||||
"#{ENV['FRONTEND_URL']}/webhooks/sms/#{channel.phone_number.delete_prefix('+')}"
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/sms/#{channel.phone_number.delete_prefix('+')}"
|
||||
when 'Channel::Line'
|
||||
"#{ENV['FRONTEND_URL']}/webhooks/line/#{channel.line_channel_id}"
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/line/#{channel.line_channel_id}"
|
||||
when 'Channel::Whatsapp'
|
||||
"#{ENV['FRONTEND_URL']}/webhooks/whatsapp/#{channel.phone_number}"
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/whatsapp/#{channel.phone_number}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
# index_installation_configs_on_name_and_created_at (name,created_at) UNIQUE
|
||||
#
|
||||
class InstallationConfig < ApplicationRecord
|
||||
# https://stackoverflow.com/questions/72970170/upgrading-to-rails-6-1-6-1-causes-psychdisallowedclass-tried-to-load-unspecif
|
||||
# https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
|
||||
# FIX ME : fixes breakage of installation config. we need to migrate.
|
||||
# Fix configuration in application.rb
|
||||
serialize :serialized_value, HashWithIndifferentAccess
|
||||
|
||||
before_validation :set_lock
|
||||
|
||||
@@ -28,7 +28,7 @@ class Integrations::App
|
||||
def action
|
||||
case params[:id]
|
||||
when 'slack'
|
||||
"#{params[:action]}&client_id=#{ENV['SLACK_CLIENT_ID']}&redirect_uri=#{self.class.slack_integration_url}"
|
||||
"#{params[:action]}&client_id=#{ENV.fetch('SLACK_CLIENT_ID', nil)}&redirect_uri=#{self.class.slack_integration_url}"
|
||||
else
|
||||
params[:action]
|
||||
end
|
||||
@@ -57,7 +57,7 @@ class Integrations::App
|
||||
end
|
||||
|
||||
def self.slack_integration_url
|
||||
"#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/integrations/slack"
|
||||
"#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/integrations/slack"
|
||||
end
|
||||
|
||||
class << self
|
||||
|
||||
@@ -21,7 +21,7 @@ class Label < ApplicationRecord
|
||||
belongs_to :account
|
||||
|
||||
validates :title,
|
||||
presence: { message: 'must not be blank' },
|
||||
presence: { message: I18n.t('errors.validations.presence') },
|
||||
format: { with: UNICODE_CHARACTER_NUMBER_HYPHEN_UNDERSCORE },
|
||||
uniqueness: { scope: :account_id }
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class Message < ApplicationRecord
|
||||
# move this to a presenter
|
||||
return self[:content] if !input_csat? || inbox.web_widget?
|
||||
|
||||
I18n.t('conversations.survey.response', link: "#{ENV['FRONTEND_URL']}/survey/responses/#{conversation.uuid}")
|
||||
I18n.t('conversations.survey.response', link: "#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{conversation.uuid}")
|
||||
end
|
||||
|
||||
def email_notifiable_message?
|
||||
|
||||
@@ -26,7 +26,7 @@ class Team < ApplicationRecord
|
||||
has_many :conversations, dependent: :nullify
|
||||
|
||||
validates :name,
|
||||
presence: { message: 'must not be blank' },
|
||||
presence: { message: I18n.t('errors.validations.presence') },
|
||||
uniqueness: { scope: :account_id }
|
||||
|
||||
before_validation do
|
||||
|
||||
Reference in New Issue
Block a user