diff --git a/Gemfile.lock b/Gemfile.lock index f9e253e6c..16e57d4f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -727,7 +727,7 @@ GEM retriable (3.1.2) reverse_markdown (2.1.1) nokogiri - rexml (3.4.1) + rexml (3.4.4) rotp (6.3.0) rspec-core (3.13.0) rspec-support (~> 3.13.0) diff --git a/app/controllers/public/api/v1/inboxes/conversations_controller.rb b/app/controllers/public/api/v1/inboxes/conversations_controller.rb index 4e3b5dca9..242dcde77 100644 --- a/app/controllers/public/api/v1/inboxes/conversations_controller.rb +++ b/app/controllers/public/api/v1/inboxes/conversations_controller.rb @@ -3,7 +3,7 @@ class Public::Api::V1::Inboxes::ConversationsController < Public::Api::V1::Inbox before_action :set_conversation, only: [:toggle_typing, :update_last_seen, :show, :toggle_status] def index - @conversations = @contact_inbox.hmac_verified? ? @contact.conversations : @contact_inbox.conversations + @conversations = @contact_inbox.hmac_verified? ? @contact_inbox.contact.conversations : @contact_inbox.conversations end def show; end diff --git a/app/finders/email_channel_finder.rb b/app/finders/email_channel_finder.rb index 41cd8e910..1b6d6f844 100644 --- a/app/finders/email_channel_finder.rb +++ b/app/finders/email_channel_finder.rb @@ -6,19 +6,54 @@ class EmailChannelFinder end def perform - channel = nil - - recipient_mails.each do |email| - normalized_email = normalize_email_with_plus_addressing(email) - channel = Channel::Email.find_by('lower(email) = ? OR lower(forward_to_email) = ?', normalized_email, normalized_email) - - break if channel.present? - end - channel + channel_from_primary_recipients || channel_from_bcc_recipients end - def recipient_mails - recipient_addresses = @email_object.to.to_a + @email_object.cc.to_a + @email_object.bcc.to_a + [@email_object['X-Original-To'].try(:value)] - recipient_addresses.flatten.compact + private + + def channel_from_primary_recipients + primary_recipient_emails.each do |email| + channel = channel_from_email(email) + return channel if channel.present? + end + + nil + end + + def channel_from_bcc_recipients + bcc_recipient_emails.each do |email| + channel = channel_from_email(email) + + # Skip if BCC processing is disabled for this account + next if channel && !allow_bcc_processing?(channel.account_id) + + return channel if channel.present? + end + + nil + end + + def primary_recipient_emails + (@email_object.to.to_a + @email_object.cc.to_a + [@email_object['X-Original-To'].try(:value)]).flatten.compact + end + + def bcc_recipient_emails + @email_object.bcc.to_a.flatten.compact + end + + def channel_from_email(email) + normalized_email = normalize_email_with_plus_addressing(email) + Channel::Email.find_by('lower(email) = ? OR lower(forward_to_email) = ?', normalized_email, normalized_email) + end + + def bcc_processing_skipped_accounts + config_value = GlobalConfigService.load('SKIP_INCOMING_BCC_PROCESSING', '') + return [] if config_value.blank? + + config_value.split(',').map(&:to_i) + end + + def allow_bcc_processing?(account_id) + bcc_processing_skipped_accounts.exclude?(account_id) end end diff --git a/app/javascript/dashboard/components-next/captain/AnimatingImg/AnimatingImg.story.vue b/app/javascript/dashboard/components-next/captain/AnimatingImg/AnimatingImg.story.vue new file mode 100644 index 000000000..c75e6bd6d --- /dev/null +++ b/app/javascript/dashboard/components-next/captain/AnimatingImg/AnimatingImg.story.vue @@ -0,0 +1,34 @@ + + + diff --git a/app/javascript/dashboard/components-next/captain/AnimatingImg/Guardrails.vue b/app/javascript/dashboard/components-next/captain/AnimatingImg/Guardrails.vue new file mode 100644 index 000000000..e99d01758 --- /dev/null +++ b/app/javascript/dashboard/components-next/captain/AnimatingImg/Guardrails.vue @@ -0,0 +1,1000 @@ + + + + + diff --git a/app/javascript/dashboard/components-next/captain/AnimatingImg/ResponseGuidelines.vue b/app/javascript/dashboard/components-next/captain/AnimatingImg/ResponseGuidelines.vue new file mode 100644 index 000000000..958f97dee --- /dev/null +++ b/app/javascript/dashboard/components-next/captain/AnimatingImg/ResponseGuidelines.vue @@ -0,0 +1,990 @@ + + + + + diff --git a/app/javascript/dashboard/components-next/captain/AnimatingImg/Scenarios.vue b/app/javascript/dashboard/components-next/captain/AnimatingImg/Scenarios.vue new file mode 100644 index 000000000..b50bcf0ac --- /dev/null +++ b/app/javascript/dashboard/components-next/captain/AnimatingImg/Scenarios.vue @@ -0,0 +1,1060 @@ + + + + + diff --git a/app/javascript/dashboard/components-next/captain/AnimatingImg/Settings.vue b/app/javascript/dashboard/components-next/captain/AnimatingImg/Settings.vue new file mode 100644 index 000000000..d50b2ff54 --- /dev/null +++ b/app/javascript/dashboard/components-next/captain/AnimatingImg/Settings.vue @@ -0,0 +1,752 @@ + + + diff --git a/app/javascript/dashboard/components-next/message/chips/Audio.vue b/app/javascript/dashboard/components-next/message/chips/Audio.vue index 431058463..667d2d7b6 100644 --- a/app/javascript/dashboard/components-next/message/chips/Audio.vue +++ b/app/javascript/dashboard/components-next/message/chips/Audio.vue @@ -1,8 +1,16 @@