Merge branch 'feat/sso-models' of github.com:chatwoot/chatwoot into feat/saml-controllers

This commit is contained in:
Shivam Mishra
2025-08-28 17:54:15 +05:30
370 changed files with 4308 additions and 2555 deletions
+4
View File
@@ -145,6 +145,10 @@ class Inbox < ApplicationRecord
channel_type == 'Channel::TwitterProfile'
end
def telegram?
channel_type == 'Channel::Telegram'
end
def whatsapp?
channel_type == 'Channel::Whatsapp'
end
+21 -2
View File
@@ -39,6 +39,8 @@
#
class Message < ApplicationRecord
searchkick callbacks: :async if ChatwootApp.advanced_search_allowed?
include MessageFilterHelpers
include Liquidable
NUMBER_OF_PERMITTED_ATTACHMENTS = 15
@@ -139,14 +141,23 @@ class Message < ApplicationRecord
data = attributes.symbolize_keys.merge(
created_at: created_at.to_i,
message_type: message_type_before_type_cast,
conversation_id: conversation.display_id,
conversation: conversation_push_event_data
conversation_id: conversation&.display_id,
conversation: conversation.present? ? conversation_push_event_data : nil
)
data[:echo_id] = echo_id if echo_id.present?
data[:attachments] = attachments.map(&:push_event_data) if attachments.present?
merge_sender_attributes(data)
end
def search_data
data = attributes.symbolize_keys
data[:conversation] = conversation.present? ? conversation_push_event_data : nil
data[:attachments] = attachments.map(&:push_event_data) if attachments.present?
data[:sender] = sender.push_event_data if sender
data[:inbox] = inbox
data
end
def conversation_push_event_data
{
assignee_id: conversation.assignee_id,
@@ -228,6 +239,14 @@ class Message < ApplicationRecord
previous_changes: previous_changes)
end
def should_index?
return false unless ChatwootApp.advanced_search_allowed?
return false unless account.feature_enabled?('advanced_search')
return false unless incoming? || outgoing?
true
end
private
def prevent_message_flooding