refactor: Remove deprecated "belongs_to" relationships in Message (#7434)

- Remove the deprecated columns in message model
This commit is contained in:
Jordan Brough
2023-07-27 02:41:34 -06:00
committed by GitHub
parent ff97536095
commit a7bc855486
2 changed files with 1 additions and 5 deletions

View File

@@ -117,10 +117,6 @@ class Message < ApplicationRecord
belongs_to :account
belongs_to :inbox
belongs_to :conversation, touch: true
# FIXME: phase out user and contact after 1.4 since the info is there in sender
belongs_to :user, required: false
belongs_to :contact, required: false
belongs_to :sender, polymorphic: true, required: false
has_many :attachments, dependent: :destroy, autosave: true, before_add: :validate_attachments_limit

View File

@@ -22,7 +22,7 @@ if conversation.messages.first.blank?
elsif conversation.unread_incoming_messages.count.zero?
json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)]
else
json.messages conversation.unread_messages.includes([:user, { attachments: [{ file_attachment: [:blob] }] }]).last(10).map(&:push_event_data)
json.messages conversation.unread_messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last(10).map(&:push_event_data)
end
json.account_id conversation.account_id