Skip to content

Commit

Permalink
Merge branch 'sendingtk:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
neocol83 authored Nov 13, 2024
2 parents c4d0527 + a7b109a commit 0309ec0
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 10 deletions.
5 changes: 3 additions & 2 deletions app/builders/contact_inbox_with_contact_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def find_or_create_contact_and_contact_inbox

ActiveRecord::Base.transaction(requires_new: true) do
build_contact_with_contact_inbox
update_contact_avatar(@contact) unless @contact.avatar.attached?
end
update_contact_avatar(@contact) unless @contact.avatar.attached?

@contact_inbox
end

Expand All @@ -48,7 +49,7 @@ def create_contact_inbox
end

def update_contact_avatar(contact)
::Avatar::AvatarFromUrlJob.set(wait: 30.seconds).perform_later(contact, contact_attributes[:avatar_url]) if contact_attributes[:avatar_url]
::Avatar::AvatarFromUrlJob.perform_later(contact, contact_attributes[:avatar_url]) if contact_attributes[:avatar_url]
end

def create_contact
Expand Down
34 changes: 34 additions & 0 deletions app/mailboxes/support_mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,38 @@ def find_or_create_contact
def identify_contact_name
processed_mail.sender_name || processed_mail.from.first.split('@').first
end

def add_attachments_to_message
return if @message.blank?

mail.attachments.each do |attachment|
file = StringIO.new(attachment.body.decoded)
@message.attachments.new(
account_id: @account.id,
file: {
io: file,
filename: attachment.filename,
content_type: attachment.content_type
}
)
end
@message.save!
end

def create_message
@message = @conversation.messages.create!(
account_id: @conversation.account_id,
inbox_id: @conversation.inbox_id,
message_type: 'incoming',
content: processed_mail.text_content[:reply] || processed_mail.html_content[:reply],
content_type: 'incoming_email',
content_attributes: {
email: processed_mail.serialized_data,
cc_email: processed_mail.cc,
bcc_email: processed_mail.bcc
},
source_id: processed_mail.message_id,
sender: @contact
)
end
end
4 changes: 1 addition & 3 deletions app/services/facebook/send_on_facebook_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ def perform_reply

if message.attachments.present?
message.attachments.each do |attachment|
retryable(tries: 3, on: Facebook::Messenger::FacebookError, sleep: 3) do
send_message_to_facebook fb_attachment_message_params(attachment)
end
send_message_to_facebook fb_attachment_message_params(attachment)
end
end
rescue Facebook::Messenger::FacebookError => e
Expand Down
2 changes: 1 addition & 1 deletion app/views/public/api/v1/portals/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<%# Uncategorized articles %>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-x-6 gap-y-6">
<% if @portal.articles.where(status: :published, category_id: nil).count > 0 %>
<% if @portal.articles.where(status: :published, category_id: nil, locale: @locale).count > 0 %>
<%= render "public/api/v1/portals/uncategorized-block", category: "Uncategorized", portal: @portal %>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion config/app.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared: &shared
version: '3.13.6'
version: '3.13.8'

development:
<<: *shared
Expand Down
5 changes: 5 additions & 0 deletions config/initializers/rack_timeout.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rack-timeout'
# Reduce noise by filtering state=ready and state=completed which are logged at INFO level
Rails.application.config.after_initialize do
Rack::Timeout::Logger.level = Logger::ERROR
end
3 changes: 1 addition & 2 deletions lib/redis/alfred.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def rpop(key)
end

def lpush(key, values)
#$alfred.with { |conn| conn.lpush(key, values) }
$alfred.with { |conn| conn.lpush(key, *values) }
$alfred.with { |conn| conn.lpush(key, values) }
end

def rpoplpush(source, destination)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chatwoot/chatwoot",
"version": "3.13.6",
"version": "3.13.8",
"license": "MIT",
"scripts": {
"eslint": "eslint app/**/*.{js,vue}",
Expand Down

0 comments on commit 0309ec0

Please sign in to comment.