Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3.13.0 dev #1

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ debug:
debug_worker:
overmind connect worker

docker:
docker:
docker build -t $(APP_NAME) -f ./docker/Dockerfile .

docker-amd64:
docker build --platform linux/amd64 -t $(APP_NAME) -f ./docker/Dockerfile .

.PHONY: setup db_create db_migrate db_seed db_reset db console server burn docker run force_run debug debug_worker
12 changes: 12 additions & 0 deletions app/javascript/shared/constants/countries.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ const countries = [
emoji: '🇩🇴',
id: 'DO',
},
{
name: 'Dominican Republic',
dial_code: '+1809',
emoji: '🇩🇴',
id: 'DO',
},
{
name: 'Dominican Republic',
dial_code: '+1829',
emoji: '🇩🇴',
id: 'DO',
},
{
name: 'Ecuador',
dial_code: '+593',
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/content_attribute_validator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ContentAttributeValidator < ActiveModel::Validator
ALLOWED_SELECT_ITEM_KEYS = [:title, :value].freeze
ALLOWED_SELECT_ITEM_KEYS = [:title, :value, :description].freeze
ALLOWED_CARD_ITEM_KEYS = [:title, :description, :media_url, :actions].freeze
ALLOWED_CARD_ITEM_ACTION_KEYS = [:text, :type, :payload, :uri].freeze
ALLOWED_FORM_ITEM_KEYS = [:type, :placeholder, :label, :name, :options, :default, :required, :pattern, :title, :pattern_error].freeze
Expand Down
2 changes: 1 addition & 1 deletion app/models/conversation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Conversation < ApplicationRecord
scope :unassigned, -> { where(assignee_id: nil) }
scope :assigned, -> { where.not(assignee_id: nil) }
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
scope :unattended, -> { where(first_reply_created_at: nil).or(where.not(waiting_since: nil)) }
scope :unattended, -> { where(first_reply_created_at: nil).or(where.not(waiting_since: nil)).where('waiting_since < ?', 10.minutes.ago) }
scope :resolvable, lambda { |auto_resolve_duration|
return none if auto_resolve_duration.to_i.zero?

Expand Down
6 changes: 4 additions & 2 deletions app/models/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Message < ApplicationRecord
# [:external_error : Can specify if the message creation failed due to an error at external API
store :content_attributes, accessors: [:submitted_email, :items, :submitted_values, :email, :in_reply_to, :deleted,
:external_created_at, :story_sender, :story_id, :external_error,
:translations, :in_reply_to_external_id, :is_unsupported], coder: JSON
:translations, :in_reply_to_external_id, :in_reply_to_interactive_id, :is_unsupported], coder: JSON

store :external_source_ids, accessors: [:slack], coder: JSON, prefix: :external_source_id

Expand Down Expand Up @@ -253,11 +253,13 @@ def ensure_processed_message_content
def ensure_in_reply_to
in_reply_to = content_attributes[:in_reply_to]
in_reply_to_external_id = content_attributes[:in_reply_to_external_id]
in_reply_to_interactive_id = content_attributes[:in_reply_to_interactive_id]

Messages::InReplyToMessageBuilder.new(
message: self,
in_reply_to: in_reply_to,
in_reply_to_external_id: in_reply_to_external_id
in_reply_to_external_id: in_reply_to_external_id,
in_reply_to_interactive_id: in_reply_to_interactive_id
).perform
end

Expand Down
2 changes: 1 addition & 1 deletion app/presenters/reports/time_format_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(seconds)
end

def format
return '--' if seconds.nil? || seconds.zero?
return ' ' if seconds.nil? || seconds.zero?

days, remainder = seconds.divmod(86_400)
hours, remainder = remainder.divmod(3600)
Expand Down
2 changes: 1 addition & 1 deletion app/services/messages/in_reply_to_message_builder.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Messages::InReplyToMessageBuilder
pattr_initialize [:message!, :in_reply_to!, :in_reply_to_external_id!]
pattr_initialize [:message!, :in_reply_to!, :in_reply_to_external_id!, :in_reply_to_interactive_id!]

delegate :conversation, to: :message

Expand Down
3 changes: 2 additions & 1 deletion app/services/whatsapp/incoming_message_base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def create_message(message)
message_type: :incoming,
sender: @contact,
source_id: message[:id].to_s,
in_reply_to_external_id: @in_reply_to_external_id
in_reply_to_external_id: @in_reply_to_external_id,
in_reply_to_interactive_id: @in_reply_to_interactive_id
)
end

Expand Down
1 change: 1 addition & 0 deletions app/services/whatsapp/incoming_message_service_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def log_error(message)

def process_in_reply_to(message)
@in_reply_to_external_id = message['context']&.[]('id')
@in_reply_to_interactive_id = message['interactive']&.[]('list_reply')&.[]('id') || message['interactive']&.[]('button_reply')&.[]('id')
end

def find_message_by_source_id(source_id)
Expand Down
3 changes: 3 additions & 0 deletions app/services/whatsapp/providers/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def create_rows(items)
rows = []
items.each do |item|
row = { 'id' => item['value'], 'title' => item['title'] }
if item.has_key?("description")
row['description'] = item['description']
end
rows << row
end
rows
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.production.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
base: &base
image: chatwoot/chatwoot:latest
Expand Down Expand Up @@ -35,7 +33,7 @@ services:
restart: always

postgres:
image: postgres:12
image: postgres:15
restart: always
ports:
- '127.0.0.1:5432:5432'
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
base: &base
build:
Expand Down Expand Up @@ -39,7 +37,7 @@ services:
command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml']

postgres:
image: postgres:12
image: postgres:15
restart: always
ports:
- '5432:5432'
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
base: &base
build:
Expand Down Expand Up @@ -84,7 +82,7 @@ services:
command: bin/webpack-dev-server

postgres:
image: postgres:12
image: postgres:15
restart: always
ports:
- '5432:5432'
Expand Down
Loading