mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
refactor: Remove deprecated "belongs_to" relationships in Message (#7434)
- Remove the deprecated columns in message model
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user