feat: Link help center portal to an Inbox (#6903)

This commit is contained in:
Tejaswini Chile
2023-04-24 12:49:52 +05:30
committed by GitHub
parent f825a22997
commit e3193dcabc
11 changed files with 77 additions and 3 deletions

View File

@@ -23,11 +23,17 @@
# updated_at :datetime not null
# account_id :integer not null
# channel_id :integer not null
# portal_id :bigint
#
# Indexes
#
# index_inboxes_on_account_id (account_id)
# index_inboxes_on_channel_id_and_channel_type (channel_id,channel_type)
# index_inboxes_on_portal_id (portal_id)
#
# Foreign Keys
#
# fk_rails_... (portal_id => portals.id)
#
class Inbox < ApplicationRecord
@@ -45,6 +51,7 @@ class Inbox < ApplicationRecord
validate :ensure_valid_max_assignment_limit
belongs_to :account
belongs_to :portal, optional: true
belongs_to :channel, polymorphic: true, dependent: :destroy

View File

@@ -37,6 +37,7 @@ class Portal < ApplicationRecord
dependent: :nullify,
source: :user
has_one_attached :logo
has_many :inboxes, dependent: :nullify
before_validation -> { normalize_empty_string_to_nil(%i[custom_domain homepage_link]) }
validates :account_id, presence: true