Compare commits

...
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -34,9 +34,11 @@ class Attachment < ApplicationRecord
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.openxmlformats-officedocument.wordprocessingml.document
].freeze
has_one_attached :file
belongs_to :account
belongs_to :message
has_one_attached :file
validate :acceptable_file
validates :external_url, length: { maximum: Limits::URL_LENGTH_LIMIT }
enum file_type: { :image => 0, :audio => 1, :video => 2, :file => 3, :location => 4, :fallback => 5, :share => 6, :story_mention => 7,
+2 -2
View File
@@ -123,12 +123,12 @@ class Message < ApplicationRecord
belongs_to :conversation, touch: true
belongs_to :sender, polymorphic: true, optional: true
after_create_commit :execute_after_create_commit_callbacks
has_many :attachments, dependent: :destroy, autosave: true, before_add: :validate_attachments_limit
has_one :csat_survey_response, dependent: :destroy_async
has_many :notifications, as: :primary_actor, dependent: :destroy_async
after_create_commit :execute_after_create_commit_callbacks
after_update_commit :dispatch_update_event
def channel_token
@@ -1,4 +1,6 @@
class AddIndexToMessages < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
# This index is added as a temporary fix for performance issues in the CSAT
# responses controller where we query messages with account_id, content_type