chore: Upgrade rails and ruby versions (#2400)

ruby version: 3.0.2
rails version: 6.1.4
This commit is contained in:
Sojan Jose
2021-08-03 20:11:52 +05:30
committed by GitHub
parent 7e960b7c72
commit ab54d9c629
61 changed files with 498 additions and 626 deletions

View File

@@ -7,7 +7,7 @@ defaults: &defaults
working_directory: ~/build working_directory: ~/build
docker: docker:
# specify the version you desire here # specify the version you desire here
- image: circleci/ruby:2.7.3-node-browsers - image: circleci/ruby:3.0.2-node-browsers
# Specify service dependencies here if necessary # Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images # CircleCI maintains a library of pre-built images

View File

@@ -1,5 +1,5 @@
# pre-build stage # pre-build stage
ARG VARIANT=2.7 ARG VARIANT=3
FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT}
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user. # Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.

View File

@@ -10,8 +10,8 @@ services:
context: .. context: ..
dockerfile: .devcontainer/Dockerfile dockerfile: .devcontainer/Dockerfile
args: args:
# Update 'VARIANT' to pick a Ruby version: 2, 2.7, 2.6, 2.5 # Update 'VARIANT' to pick a Ruby version: https://github.com/microsoft/vscode-dev-containers/tree/main/containers/ruby
VARIANT: 2.7 VARIANT: 3
# [Choice] Install Node.js # [Choice] Install Node.js
INSTALL_NODE: "true" INSTALL_NODE: "true"
NODE_VERSION: "lts/*" NODE_VERSION: "lts/*"

2
.nvmrc
View File

@@ -1 +1 @@
12.16.1 16.1.0

View File

@@ -40,6 +40,14 @@ Style/ClassVars:
Lint/MissingSuper: Lint/MissingSuper:
Exclude: Exclude:
- 'app/drops/base_drop.rb' - 'app/drops/base_drop.rb'
Lint/SymbolConversion:
Enabled: false
Lint/EmptyBlock:
Exclude:
- 'app/views/api/v1/accounts/conversations/toggle_status.json.jbuilder'
Lint/OrAssignmentToConstant:
Exclude:
- 'lib/redis/config.rb'
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- spec/**/* - spec/**/*
@@ -58,6 +66,10 @@ Rails/ApplicationController:
- 'app/controllers/platform_controller.rb' - 'app/controllers/platform_controller.rb'
- 'app/controllers/public_controller.rb' - 'app/controllers/public_controller.rb'
- 'app/controllers/survey/responses_controller.rb' - 'app/controllers/survey/responses_controller.rb'
Rails/EnvironmentVariableAccess:
Enabled: false
Rails/TimeZoneAssignment:
Enabled: false
Style/ClassAndModuleChildren: Style/ClassAndModuleChildren:
EnforcedStyle: compact EnforcedStyle: compact
Exclude: Exclude:
@@ -67,6 +79,10 @@ RSpec/NestedGroups:
Max: 4 Max: 4
RSpec/MessageSpies: RSpec/MessageSpies:
Enabled: false Enabled: false
RSpec/StubbedMock:
Enabled: false
Naming/VariableNumber:
Enabled: false
Metrics/MethodLength: Metrics/MethodLength:
Exclude: Exclude:
- 'db/migrate/20161123131628_devise_token_auth_create_users.rb' - 'db/migrate/20161123131628_devise_token_auth_create_users.rb'
@@ -114,14 +130,19 @@ Rails/UniqueValidationWithoutIndex:
- 'app/models/channel/twitter_profile.rb' - 'app/models/channel/twitter_profile.rb'
- 'app/models/webhook.rb' - 'app/models/webhook.rb'
- 'app/models/contact.rb' - 'app/models/contact.rb'
- 'app/models/integrations/hook.rb'
Rails/RenderInline: Rails/RenderInline:
Exclude: Exclude:
- 'app/controllers/swagger_controller.rb' - 'app/controllers/swagger_controller.rb'
Performance/CollectionLiteralInLoop:
Exclude:
- 'db/migrate/20210315101919_enable_email_channel.rb'
RSpec/NamedSubject: RSpec/NamedSubject:
Enabled: false Enabled: false
# we should bring this down # we should bring this down
RSpec/MultipleMemoizedHelpers: RSpec/MultipleMemoizedHelpers:
Max: 12 Max: 12
AllCops: AllCops:
NewCops: enable NewCops: enable
Exclude: Exclude:
@@ -136,4 +157,11 @@ AllCops:
- 'tmp/**/*' - 'tmp/**/*'
- 'storage/**/*' - 'storage/**/*'
- 'db/migrate/20200225162150_init_schema.rb' - 'db/migrate/20200225162150_init_schema.rb'
- 'config/initializers/azure_storage_service_patch.rb' - 'db/migrate/20210611180222_create_active_storage_variant_records.active_storage.rb'
- 'db/migrate/20210611180221_add_service_name_to_active_storage_blobs.active_storage.rb'
- db/migrate/20200309213132_add_account_id_to_agent_bot_inboxes.rb
- db/migrate/20200331095710_add_identifier_to_contact.rb
- db/migrate/20200429082655_add_medium_to_twilio_sms.rb
- db/migrate/20200503151130_add_account_feature_flag.rb
- db/migrate/20200927135222_add_last_activity_at_to_conversation.rb
- db/migrate/20210306170117_add_last_activity_at_to_contacts.rb

View File

@@ -1 +1 @@
2.7.3 3.0.2

17
Gemfile
View File

@@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.7.3' ruby '3.0.2'
##-- base gems for rails --## ##-- base gems for rails --##
gem 'rack-cors', require: 'rack/cors' gem 'rack-cors', require: 'rack/cors'
@@ -40,7 +40,7 @@ gem 'rack-attack'
gem 'aws-sdk-s3', require: false gem 'aws-sdk-s3', require: false
gem 'azure-storage-blob', require: false gem 'azure-storage-blob', require: false
gem 'google-cloud-storage', require: false gem 'google-cloud-storage', require: false
gem 'mini_magick' gem 'image_processing'
##-- gems for database --# ##-- gems for database --#
gem 'groupdate' gem 'groupdate'
@@ -91,8 +91,11 @@ gem 'google-cloud-dialogflow'
##--- gems for debugging and error reporting ---## ##--- gems for debugging and error reporting ---##
# static analysis # static analysis
gem 'brakeman' gem 'brakeman'
gem 'ddtrace'
gem 'scout_apm' gem 'scout_apm'
gem 'sentry-raven' gem 'sentry-rails'
gem 'sentry-ruby'
gem 'sentry-sidekiq'
##-- background job processing --## ##-- background job processing --##
gem 'sidekiq' gem 'sidekiq'
@@ -121,7 +124,7 @@ group :development do
gem 'web-console' gem 'web-console'
# used in swagger build # used in swagger build
gem 'json_refs', git: 'https://github.com/tzmfreedom/json_refs', ref: '131b11294fd6af9c428171f38516e6222a58c874' gem 'json_refs'
# When we want to squash migrations # When we want to squash migrations
gem 'squasher' gem 'squasher'
@@ -135,19 +138,19 @@ group :test do
end end
group :development, :test do group :development, :test do
gem 'active_record_query_trace'
gem 'bundle-audit', require: false gem 'bundle-audit', require: false
gem 'byebug', platform: :mri gem 'byebug', platform: :mri
gem 'factory_bot_rails' gem 'factory_bot_rails'
gem 'faker' gem 'faker'
gem 'listen' gem 'listen'
gem 'mock_redis', git: 'https://github.com/sds/mock_redis', ref: '16d00789f0341a3aac35126c0ffe97a596753ff9' gem 'mock_redis'
gem 'pry-rails' gem 'pry-rails'
gem 'rspec-rails', '~> 4.0.0.beta2' gem 'rspec-rails', '~> 5.0.0'
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'rubocop-performance', require: false gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false gem 'rubocop-rails', require: false
gem 'rubocop-rspec', require: false gem 'rubocop-rspec', require: false
gem 'scss_lint', require: false
gem 'seed_dump' gem 'seed_dump'
gem 'shoulda-matchers' gem 'shoulda-matchers'
gem 'simplecov', '0.17.1', require: false gem 'simplecov', '0.17.1', require: false

View File

@@ -1,80 +1,70 @@
GIT
remote: https://github.com/sds/mock_redis
revision: 16d00789f0341a3aac35126c0ffe97a596753ff9
ref: 16d00789f0341a3aac35126c0ffe97a596753ff9
specs:
mock_redis (0.22.0)
GIT
remote: https://github.com/tzmfreedom/json_refs
revision: 131b11294fd6af9c428171f38516e6222a58c874
ref: 131b11294fd6af9c428171f38516e6222a58c874
specs:
json_refs (0.1.6)
hana
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.0.3.7) actioncable (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
activesupport (= 6.1.4)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.7) actionmailbox (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
activejob (= 6.0.3.7) activejob (= 6.1.4)
activerecord (= 6.0.3.7) activerecord (= 6.1.4)
activestorage (= 6.0.3.7) activestorage (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.0.3.7) actionmailer (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
actionview (= 6.0.3.7) actionview (= 6.1.4)
activejob (= 6.0.3.7) activejob (= 6.1.4)
activesupport (= 6.1.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.0.3.7) actionpack (6.1.4)
actionview (= 6.0.3.7) actionview (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.7) actiontext (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
activerecord (= 6.0.3.7) activerecord (= 6.1.4)
activestorage (= 6.0.3.7) activestorage (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.0.3.7) actionview (6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.7) active_record_query_trace (1.8)
activesupport (= 6.0.3.7) activejob (6.1.4)
activesupport (= 6.1.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.0.3.7) activemodel (6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
activerecord (6.0.3.7) activerecord (6.1.4)
activemodel (= 6.0.3.7) activemodel (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
activerecord-import (1.0.7) activerecord-import (1.2.0)
activerecord (>= 3.2) activerecord (>= 3.2)
activestorage (6.0.3.7) activestorage (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
activejob (= 6.0.3.7) activejob (= 6.1.4)
activerecord (= 6.0.3.7) activerecord (= 6.1.4)
activesupport (= 6.1.4)
marcel (~> 1.0.0) marcel (~> 1.0.0)
activesupport (6.0.3.7) mini_mime (>= 1.1.0)
activesupport (6.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
zeitwerk (~> 2.2, >= 2.2.2) zeitwerk (~> 2.3)
acts-as-taggable-on (6.5.0) acts-as-taggable-on (8.1.0)
activerecord (>= 5.0, < 6.1) activerecord (>= 5.0, < 6.2)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
administrate (0.16.0) administrate (0.16.0)
@@ -90,23 +80,23 @@ GEM
annotate (3.1.1) annotate (3.1.1)
activerecord (>= 3.2, < 7.0) activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0) rake (>= 10.4, < 14.0)
ast (2.4.1) ast (2.4.2)
attr_extras (6.2.4) attr_extras (6.2.4)
aws-eventstream (1.1.0) aws-eventstream (1.1.1)
aws-partitions (1.360.0) aws-partitions (1.482.0)
aws-sdk-core (3.105.0) aws-sdk-core (3.119.0)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0) aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
jmespath (~> 1.0) jmespath (~> 1.0)
aws-sdk-kms (1.37.0) aws-sdk-kms (1.46.0)
aws-sdk-core (~> 3, >= 3.99.0) aws-sdk-core (~> 3, >= 3.119.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.79.1) aws-sdk-s3 (1.98.0)
aws-sdk-core (~> 3, >= 3.104.3) aws-sdk-core (~> 3, >= 3.119.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.2) aws-sigv4 (1.2.4)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
axiom-types (0.1.1) axiom-types (0.1.1)
descendants_tracker (~> 0.0.4) descendants_tracker (~> 0.0.4)
@@ -120,42 +110,48 @@ GEM
faraday_middleware (~> 1.0.0.rc1) faraday_middleware (~> 1.0.0.rc1)
net-http-persistent (~> 4.0) net-http-persistent (~> 4.0)
nokogiri (~> 1.11.0.rc2) nokogiri (~> 1.11.0.rc2)
barnes (0.0.8) barnes (0.0.9)
multi_json (~> 1) multi_json (~> 1)
statsd-ruby (~> 1.1) statsd-ruby (~> 1.1)
bcrypt (3.1.16) bcrypt (3.1.16)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.4.8) bootsnap (1.7.6)
msgpack (~> 1.0) msgpack (~> 1.0)
brakeman (4.9.0) brakeman (5.1.1)
browser (5.3.1) browser (5.3.1)
builder (3.2.4) builder (3.2.4)
bullet (6.1.0) bullet (6.1.4)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.11) uniform_notifier (~> 1.11)
bundle-audit (0.1.0) bundle-audit (0.1.0)
bundler-audit bundler-audit
bundler-audit (0.7.0.1) bundler-audit (0.8.0)
bundler (>= 1.2.0, < 3) bundler (>= 1.2.0, < 3)
thor (>= 0.18, < 2) thor (~> 1.0)
byebug (11.1.3) byebug (11.1.3)
coderay (1.1.3) coderay (1.1.3)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
commonmarker (0.21.1) commonmarker (0.22.0)
ruby-enum (~> 0.5) concurrent-ruby (1.1.9)
concurrent-ruby (1.1.8) connection_pool (2.2.5)
connection_pool (2.2.3) crack (0.4.5)
crack (0.4.3) rexml
safe_yaml (~> 1.0.0)
crass (1.0.6) crass (1.0.6)
cypress-on-rails (1.8.0) cypress-on-rails (1.10.1)
rack rack
database_cleaner (1.8.5) database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
database_cleaner-active_record (2.0.1)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
datetime_picker_rails (0.0.7) datetime_picker_rails (0.0.7)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
ddtrace (0.51.1)
ffi (~> 1.0)
msgpack
declarative (0.0.20) declarative (0.0.20)
declarative-option (0.1.0)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
devise (4.8.0) devise (4.8.0)
@@ -167,48 +163,47 @@ GEM
devise-secure_password (2.0.1) devise-secure_password (2.0.1)
devise (>= 4.0.0, < 5.0.0) devise (>= 4.0.0, < 5.0.0)
railties (>= 5.0.0, < 7.0.0) railties (>= 5.0.0, < 7.0.0)
devise_token_auth (1.1.4) devise_token_auth (1.2.0)
bcrypt (~> 3.0) bcrypt (~> 3.0)
devise (> 3.5.2, < 5) devise (> 3.5.2, < 5)
rails (>= 4.2.0, < 6.1) rails (>= 4.2.0, < 6.2)
sprockets (= 3.7.2)
diff-lcs (1.4.4) diff-lcs (1.4.4)
digest-crc (0.6.1) digest-crc (0.6.4)
rake (~> 13.0) rake (>= 12.0.0, < 14.0.0)
docile (1.3.2) docile (1.4.0)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6) dotenv (2.7.6)
dotenv-rails (2.7.6) dotenv-rails (2.7.6)
dotenv (= 2.7.6) dotenv (= 2.7.6)
railties (>= 3.2) railties (>= 3.2)
ecma-re-validator (0.2.1) dry-inflector (0.2.1)
regexp_parser (~> 1.2) ecma-re-validator (0.3.0)
equalizer (0.0.11) regexp_parser (~> 2.0)
erubi (1.10.0) erubi (1.10.0)
et-orbi (1.2.4) et-orbi (1.2.4)
tzinfo tzinfo
execjs (2.7.0) execjs (2.8.1)
facebook-messenger (2.0.1) facebook-messenger (2.0.1)
httparty (~> 0.13, >= 0.13.7) httparty (~> 0.13, >= 0.13.7)
rack (>= 1.4.5) rack (>= 1.4.5)
factory_bot (6.1.0) factory_bot (6.2.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
factory_bot_rails (6.1.0) factory_bot_rails (6.2.0)
factory_bot (~> 6.1.0) factory_bot (~> 6.2.0)
railties (>= 5.0.0) railties (>= 5.0.0)
faker (2.13.0) faker (2.18.0)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
faraday (1.0.1) faraday (1.0.1)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday_middleware (1.0.0) faraday_middleware (1.0.0)
faraday (~> 1.0) faraday (~> 1.0)
fcm (1.0.2) fcm (1.0.3)
faraday (~> 1.0.0) faraday (~> 1)
ffi (1.15.0) ffi (1.15.3)
flag_shih_tzu (0.3.23) flag_shih_tzu (0.3.23)
foreman (0.87.2) foreman (0.87.2)
fugit (1.4.1) fugit (1.5.0)
et-orbi (~> 1.1, >= 1.1.8) et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4) raabro (~> 1.4)
gapic-common (0.3.4) gapic-common (0.3.4)
@@ -217,18 +212,23 @@ GEM
googleapis-common-protos-types (>= 1.0.4, < 2.0) googleapis-common-protos-types (>= 1.0.4, < 2.0)
googleauth (~> 0.9) googleauth (~> 0.9)
grpc (~> 1.25) grpc (~> 1.25)
geocoder (1.6.3) geocoder (1.6.7)
gli (2.19.2) gli (2.20.1)
globalid (0.4.2) globalid (0.5.1)
activesupport (>= 4.2.0) activesupport (>= 5.0)
google-api-client (0.43.0) google-apis-core (0.4.1)
addressable (~> 2.5, >= 2.5.1) addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9) googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.0) httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0) mini_mime (~> 1.0)
representable (~> 3.0) representable (~> 3.0)
retriable (>= 2.0, < 4.0) retriable (>= 2.0, < 4.a)
signet (~> 0.12) rexml
webrick
google-apis-iamcredentials_v1 (0.6.0)
google-apis-core (>= 0.4, < 2.a)
google-apis-storage_v1 (0.6.0)
google-apis-core (>= 0.4, < 2.a)
google-cloud-core (1.6.0) google-cloud-core (1.6.0)
google-cloud-env (~> 1.0) google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0) google-cloud-errors (~> 1.0)
@@ -241,21 +241,23 @@ GEM
google-cloud-env (1.5.0) google-cloud-env (1.5.0)
faraday (>= 0.17.3, < 2.0) faraday (>= 0.17.3, < 2.0)
google-cloud-errors (1.1.0) google-cloud-errors (1.1.0)
google-cloud-storage (1.28.0) google-cloud-storage (1.34.1)
addressable (~> 2.5) addressable (~> 2.5)
digest-crc (~> 0.4) digest-crc (~> 0.4)
google-api-client (~> 0.33) google-apis-iamcredentials_v1 (~> 0.1)
google-cloud-core (~> 1.2) google-apis-storage_v1 (~> 0.1)
googleauth (~> 0.9) google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0) mini_mime (~> 1.0)
google-protobuf (3.15.8) google-protobuf (3.17.3-universal-darwin)
google-protobuf (3.17.3-x86_64-linux)
googleapis-common-protos (1.3.11) googleapis-common-protos (1.3.11)
google-protobuf (~> 3.14) google-protobuf (~> 3.14)
googleapis-common-protos-types (>= 1.0.6, < 2.0) googleapis-common-protos-types (>= 1.0.6, < 2.0)
grpc (~> 1.27) grpc (~> 1.27)
googleapis-common-protos-types (1.0.6) googleapis-common-protos-types (1.1.0)
google-protobuf (~> 3.14) google-protobuf (~> 3.14)
googleauth (0.16.2) googleauth (0.17.0)
faraday (>= 0.17.3, < 2.0) faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0) jwt (>= 1.4, < 3.0)
memoist (~> 0.16) memoist (~> 0.16)
@@ -264,11 +266,14 @@ GEM
signet (~> 0.14) signet (~> 0.14)
groupdate (5.2.2) groupdate (5.2.2)
activesupport (>= 5) activesupport (>= 5)
grpc (1.37.1) grpc (1.38.0-universal-darwin)
google-protobuf (~> 3.15) google-protobuf (~> 3.15)
googleapis-common-protos-types (~> 1.0) googleapis-common-protos-types (~> 1.0)
haikunator (1.1.0) grpc (1.38.0-x86_64-linux)
hairtrigger (0.2.23) google-protobuf (~> 3.15)
googleapis-common-protos-types (~> 1.0)
haikunator (1.1.1)
hairtrigger (0.2.24)
activerecord (>= 5.0, < 7) activerecord (>= 5.0, < 7)
ruby2ruby (~> 2.4) ruby2ruby (~> 2.4)
ruby_parser (~> 3.10) ruby_parser (~> 3.10)
@@ -277,7 +282,7 @@ GEM
hashie (4.1.0) hashie (4.1.0)
hkdf (0.3.0) hkdf (0.3.0)
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.3) http-cookie (1.0.4)
domain_name (~> 0.5) domain_name (~> 0.5)
httparty (0.18.1) httparty (0.18.1)
mime-types (~> 3.0) mime-types (~> 3.0)
@@ -286,19 +291,23 @@ GEM
i18n (1.8.10) i18n (1.8.10)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
ice_nine (0.11.2) ice_nine (0.11.2)
inflecto (0.0.2) image_processing (1.12.1)
jbuilder (2.10.0) mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
jbuilder (2.11.2)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jmespath (1.4.0) jmespath (1.4.0)
jquery-rails (4.4.0) jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (2.3.1) json (2.5.1)
json_schemer (0.2.16) json_refs (0.1.6)
ecma-re-validator (~> 0.2) hana
json_schemer (0.2.18)
ecma-re-validator (~> 0.3)
hana (~> 1.3) hana (~> 1.3)
regexp_parser (~> 1.5) regexp_parser (~> 2.0)
uri_template (~> 0.7) uri_template (~> 0.7)
jwt (2.2.3) jwt (2.2.3)
kaminari (1.2.1) kaminari (1.2.1)
@@ -321,11 +330,11 @@ GEM
addressable (~> 2.7) addressable (~> 2.7)
letter_opener (1.7.0) letter_opener (1.7.0)
launchy (~> 2.2) launchy (~> 2.2)
liquid (4.0.3) liquid (5.0.1)
listen (3.3.3) listen (3.6.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.9.1) loofah (2.11.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@@ -336,40 +345,42 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mime-types (3.3.1) mime-types (3.3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225) mime-types-data (3.2021.0704)
mini_magick (4.10.1) mini_magick (4.11.0)
mini_mime (1.1.0) mini_mime (1.1.0)
mini_portile2 (2.5.1)
minitest (5.14.4) minitest (5.14.4)
mock_redis (0.28.0)
ruby2_keywords
momentjs-rails (2.20.1) momentjs-rails (2.20.1)
railties (>= 3.1) railties (>= 3.1)
msgpack (1.3.3) msgpack (1.4.2)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.1.1) multipart-post (2.1.1)
net-http-persistent (4.0.0) net-http-persistent (4.0.1)
connection_pool (~> 2.2) connection_pool (~> 2.2)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.5.7) nio4r (2.5.7)
nokogiri (1.11.6) nokogiri (1.11.7-x86_64-darwin)
mini_portile2 (~> 2.5.0) racc (~> 1.4)
nokogiri (1.11.7-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
oauth (0.5.6) oauth (0.5.6)
orm_adapter (0.5.0) orm_adapter (0.5.0)
os (1.1.1) os (1.1.1)
parallel (1.19.2) parallel (1.20.1)
parser (2.7.1.4) parser (3.0.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.2.3) pg (1.2.3)
procore-sift (0.15.0) procore-sift (0.16.0)
rails (> 4.2.0) rails (> 4.2.0)
pry (0.13.1) pry (0.14.1)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (4.0.6) public_suffix (4.0.6)
puma (4.3.8) puma (5.4.0)
nio4r (~> 2.0) nio4r (~> 2.0)
pundit (2.1.0) pundit (2.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@@ -380,49 +391,49 @@ GEM
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-cors (1.1.1) rack-cors (1.1.1)
rack (>= 2.0.0) rack (>= 2.0.0)
rack-proxy (0.6.5) rack-proxy (0.7.0)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-timeout (0.6.0) rack-timeout (0.6.0)
rails (6.0.3.7) rails (6.1.4)
actioncable (= 6.0.3.7) actioncable (= 6.1.4)
actionmailbox (= 6.0.3.7) actionmailbox (= 6.1.4)
actionmailer (= 6.0.3.7) actionmailer (= 6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
actiontext (= 6.0.3.7) actiontext (= 6.1.4)
actionview (= 6.0.3.7) actionview (= 6.1.4)
activejob (= 6.0.3.7) activejob (= 6.1.4)
activemodel (= 6.0.3.7) activemodel (= 6.1.4)
activerecord (= 6.0.3.7) activerecord (= 6.1.4)
activestorage (= 6.0.3.7) activestorage (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
bundler (>= 1.3.0) bundler (>= 1.15.0)
railties (= 6.0.3.7) railties (= 6.1.4)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.0.3.7) railties (6.1.4)
actionpack (= 6.0.3.7) actionpack (= 6.1.4)
activesupport (= 6.0.3.7) activesupport (= 6.1.4)
method_source method_source
rake (>= 0.8.7) rake (>= 0.13)
thor (>= 0.20.3, < 2.0) thor (~> 1.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.3) rake (13.0.6)
rb-fsevent (0.10.4) rb-fsevent (0.11.0)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
redis (4.2.1) redis (4.4.0)
redis-namespace (1.8.0) redis-namespace (1.8.1)
redis (>= 3.0.4) redis (>= 3.0.4)
regexp_parser (1.7.1) regexp_parser (2.1.1)
representable (3.0.4) representable (3.1.1)
declarative (< 0.1.0) declarative (< 0.1.0)
declarative-option (< 0.2.0) trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0) uber (< 0.2.0)
responders (3.0.1) responders (3.0.1)
actionpack (>= 5.0) actionpack (>= 5.0)
@@ -434,57 +445,53 @@ GEM
netrc (~> 0.8) netrc (~> 0.8)
retriable (3.1.2) retriable (3.1.2)
rexml (3.2.5) rexml (3.2.5)
rspec-core (3.9.2) rspec-core (3.10.1)
rspec-support (~> 3.9.3) rspec-support (~> 3.10.0)
rspec-expectations (3.9.2) rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.10.0)
rspec-mocks (3.9.1) rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.10.0)
rspec-rails (4.0.1) rspec-rails (5.0.1)
actionpack (>= 4.2) actionpack (>= 5.2)
activesupport (>= 4.2) activesupport (>= 5.2)
railties (>= 4.2) railties (>= 5.2)
rspec-core (~> 3.9) rspec-core (~> 3.10)
rspec-expectations (~> 3.9) rspec-expectations (~> 3.10)
rspec-mocks (~> 3.9) rspec-mocks (~> 3.10)
rspec-support (~> 3.9) rspec-support (~> 3.10)
rspec-support (3.9.3) rspec-support (3.10.2)
rubocop (0.89.1) rubocop (1.18.4)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.1.1) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 0.3.0, < 1.0) rubocop-ast (>= 1.8.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (0.3.0) rubocop-ast (1.8.0)
parser (>= 2.7.1.4) parser (>= 3.0.1.1)
rubocop-performance (1.7.1) rubocop-performance (1.11.4)
rubocop (>= 0.82.0) rubocop (>= 1.7.0, < 2.0)
rubocop-rails (2.8.1) rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 0.87.0) rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (1.43.2) rubocop-rspec (2.4.0)
rubocop (~> 0.87) rubocop (~> 1.0)
ruby-enum (0.9.0) rubocop-ast (>= 1.1.0)
i18n ruby-progressbar (1.11.0)
ruby-progressbar (1.10.1) ruby-vips (2.1.2)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
ruby2ruby (2.4.4) ruby2ruby (2.4.4)
ruby_parser (~> 3.1) ruby_parser (~> 3.1)
sexp_processor (~> 4.6) sexp_processor (~> 4.6)
ruby_parser (3.15.0) ruby_parser (3.16.0)
rubocop (>= 0.87.0) sexp_processor (~> 4.15, >= 4.15.1)
sexp_processor (~> 4.9)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.4.0) sassc (2.4.0)
ffi (~> 1.9) ffi (~> 1.9)
sassc-rails (2.1.2) sassc-rails (2.1.2)
@@ -493,21 +500,30 @@ GEM
sprockets (> 3.0) sprockets (> 3.0)
sprockets-rails sprockets-rails
tilt tilt
scout_apm (2.6.9) scout_apm (4.1.1)
parser parser
scss_lint (0.59.0)
sass (~> 3.5, >= 3.5.5)
seed_dump (3.3.1) seed_dump (3.3.1)
activerecord (>= 4) activerecord (>= 4)
activesupport (>= 4) activesupport (>= 4)
selectize-rails (0.12.6) selectize-rails (0.12.6)
semantic_range (2.3.0) semantic_range (3.0.0)
sentry-raven (3.0.3) sentry-rails (4.6.4)
railties (>= 5.0)
sentry-ruby-core (~> 4.6.0)
sentry-ruby (4.6.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
faraday (>= 1.0) faraday (>= 1.0)
sexp_processor (4.15.1) sentry-ruby-core (= 4.6.4)
shoulda-matchers (4.4.1) sentry-ruby-core (4.6.4)
activesupport (>= 4.2.0) concurrent-ruby
sidekiq (6.1.1) faraday
sentry-sidekiq (4.6.4)
sentry-ruby-core (~> 4.6.0)
sidekiq (>= 3.0)
sexp_processor (4.15.3)
shoulda-matchers (5.0.0)
activesupport (>= 5.2.0)
sidekiq (6.2.1)
connection_pool (>= 2.2.2) connection_pool (>= 2.2.2)
rack (~> 2.0) rack (~> 2.0)
redis (>= 4.2.0) redis (>= 4.2.0)
@@ -524,7 +540,7 @@ GEM
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.2) simplecov-html (0.10.2)
slack-ruby-client (0.15.0) slack-ruby-client (0.17.0)
faraday (>= 1.0) faraday (>= 1.0)
faraday_middleware faraday_middleware
gli gli
@@ -534,7 +550,7 @@ GEM
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (3.7.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.2) sprockets-rails (3.2.2)
@@ -542,27 +558,28 @@ GEM
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
squasher (0.6.2) squasher (0.6.2)
statsd-ruby (1.4.0) statsd-ruby (1.5.0)
telegram-bot-ruby (0.12.0) telegram-bot-ruby (0.16.0)
dry-inflector
faraday faraday
inflecto virtus (~> 2.0)
virtus telephone_number (1.4.12)
telephone_number (1.4.9)
thor (1.1.0) thor (1.1.0)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
time_diff (0.3.0) time_diff (0.3.0)
activesupport activesupport
i18n i18n
trailblazer-option (0.1.1)
twilio-ruby (5.32.0) twilio-ruby (5.32.0)
faraday (~> 1.0.0) faraday (~> 1.0.0)
jwt (>= 1.5, <= 2.5) jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0) nokogiri (>= 1.6, < 2.0)
twitty (0.1.1) twitty (0.1.4)
oauth oauth
tzinfo (1.2.9) tzinfo (2.0.4)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
tzinfo-data (1.2020.1) tzinfo-data (1.2021.1)
tzinfo (>= 1.0.0) tzinfo (>= 1.0.0)
uber (0.1.0) uber (0.1.0)
uglifier (4.2.0) uglifier (4.2.0)
@@ -570,46 +587,48 @@ GEM
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.7) unf_ext (0.0.7.7)
unicode-display_width (1.7.0) unicode-display_width (2.0.0)
uniform_notifier (1.13.0) uniform_notifier (1.14.2)
uri_template (0.7.0) uri_template (0.7.0)
valid_email2 (3.3.1) valid_email2 (4.0.0)
activemodel (>= 3.2) activemodel (>= 3.2)
mail (~> 2.5) mail (~> 2.5)
virtus (1.0.5) virtus (2.0.0)
axiom-types (~> 0.1) axiom-types (~> 0.1)
coercible (~> 1.0) coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3) descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.9) warden (1.2.9)
rack (>= 2.0.9) rack (>= 2.0.9)
web-console (4.0.4) web-console (4.1.0)
actionview (>= 6.0.0) actionview (>= 6.0.0)
activemodel (>= 6.0.0) activemodel (>= 6.0.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 6.0.0) railties (>= 6.0.0)
webmock (3.8.3) webmock (3.13.0)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.2.1) webpacker (5.4.0)
activesupport (>= 5.2) activesupport (>= 5.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 5.2) railties (>= 5.2)
semantic_range (>= 2.3.0) semantic_range (>= 2.3.0)
webpush (1.0.0) webpush (1.1.0)
hkdf (~> 0.2) hkdf (~> 0.2)
jwt (~> 2.0) jwt (~> 2.0)
websocket-driver (0.7.3) webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
wisper (2.0.0) wisper (2.0.0)
zeitwerk (2.4.2) zeitwerk (2.4.2)
PLATFORMS PLATFORMS
ruby x86_64-darwin-21
x86_64-linux
DEPENDENCIES DEPENDENCIES
active_record_query_trace
activerecord-import activerecord-import
acts-as-taggable-on acts-as-taggable-on
administrate administrate
@@ -627,6 +646,7 @@ DEPENDENCIES
commonmarker commonmarker
cypress-on-rails (~> 1.0) cypress-on-rails (~> 1.0)
database_cleaner database_cleaner
ddtrace
devise devise
devise-secure_password (~> 2.0) devise-secure_password (~> 2.0)
devise_token_auth devise_token_auth
@@ -644,8 +664,9 @@ DEPENDENCIES
haikunator haikunator
hairtrigger hairtrigger
hashie hashie
image_processing
jbuilder jbuilder
json_refs! json_refs
json_schemer json_schemer
jwt jwt
kaminari kaminari
@@ -654,8 +675,7 @@ DEPENDENCIES
liquid liquid
listen listen
maxminddb maxminddb
mini_magick mock_redis
mock_redis!
pg pg
procore-sift procore-sift
pry-rails pry-rails
@@ -669,15 +689,16 @@ DEPENDENCIES
redis-namespace redis-namespace
responders responders
rest-client rest-client
rspec-rails (~> 4.0.0.beta2) rspec-rails (~> 5.0.0)
rubocop rubocop
rubocop-performance rubocop-performance
rubocop-rails rubocop-rails
rubocop-rspec rubocop-rspec
scout_apm scout_apm
scss_lint
seed_dump seed_dump
sentry-raven sentry-rails
sentry-ruby
sentry-sidekiq
shoulda-matchers shoulda-matchers
sidekiq sidekiq
sidekiq-cron sidekiq-cron
@@ -701,7 +722,7 @@ DEPENDENCIES
wisper (= 2.0.0) wisper (= 2.0.0)
RUBY VERSION RUBY VERSION
ruby 2.7.3p183 ruby 3.0.2p107
BUNDLED WITH BUNDLED WITH
2.1.4 2.2.25

View File

@@ -27,7 +27,7 @@ class Messages::Facebook::MessageBuilder
rescue Koala::Facebook::AuthenticationError rescue Koala::Facebook::AuthenticationError
Rails.logger.info "Facebook Authorization expired for Inbox #{@inbox.id}" Rails.logger.info "Facebook Authorization expired for Inbox #{@inbox.id}"
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
true true
end end
@@ -146,7 +146,7 @@ class Messages::Facebook::MessageBuilder
raise raise
rescue StandardError => e rescue StandardError => e
result = {} result = {}
Raven.capture_exception(e) Sentry.capture_exception(e)
end end
{ {
name: "#{result['first_name'] || 'John'} #{result['last_name'] || 'Doe'}", name: "#{result['first_name'] || 'John'} #{result['last_name'] || 'Doe'}",

View File

@@ -14,7 +14,7 @@ class Api::V1::Accounts::BaseController < Api::BaseController
account = Account.find(params[:account_id]) account = Account.find(params[:account_id])
if current_user if current_user
account_accessible_for_user?(account) account_accessible_for_user?(account)
elsif @resource&.is_a?(AgentBot) elsif @resource.is_a?(AgentBot)
account_accessible_for_bot?(account) account_accessible_for_bot?(account)
end end
account account

View File

@@ -69,7 +69,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController
return [] if data.empty? return [] if data.empty?
data.inject([]) do |result, page_detail| data.inject([]) do |result, page_detail|
page_detail[:exists] = Current.account.facebook_pages.exists?(page_id: page_detail['id']) ? true : false page_detail[:exists] = Current.account.facebook_pages.exists?(page_id: page_detail['id'])
result << page_detail result << page_detail
end end
end end
@@ -99,7 +99,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController
end end
pic_url = response.base_uri.to_s pic_url = response.base_uri.to_s
rescue StandardError => e rescue StandardError => e
Rails.logger.debug "Rescued: #{e.inspect}" Rails.logger.debug { "Rescued: #{e.inspect}" }
pic_url = nil pic_url = nil
end end
pic_url pic_url

View File

@@ -6,9 +6,8 @@ class Api::V1::Accounts::Channels::TwilioChannelsController < Api::V1::Accounts:
authenticate_twilio authenticate_twilio
build_inbox build_inbox
setup_webhooks if @twilio_channel.sms? setup_webhooks if @twilio_channel.sms?
rescue Twilio::REST::TwilioError => e
render_could_not_create_error(e.message)
rescue StandardError => e rescue StandardError => e
Sentry.capture_exception(e)
render_could_not_create_error(e.message) render_could_not_create_error(e.message)
end end
end end

View File

@@ -9,7 +9,7 @@ class Api::V1::Accounts::InboxMembersController < Api::V1::Accounts::BaseControl
update_agents_list update_agents_list
head :ok head :ok
rescue StandardError => e rescue StandardError => e
Rails.logger.debug "Rescued: #{e.inspect}" Rails.logger.debug { "Rescued: #{e.inspect}" }
render_could_not_create_error('Could not add agents to inbox') render_could_not_create_error('Could not add agents to inbox')
end end
end end

View File

@@ -10,7 +10,7 @@ class Api::V1::WebhooksController < ApplicationController
twitter_consumer.consume twitter_consumer.consume
head :ok head :ok
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
head :ok head :ok
end end

View File

@@ -16,7 +16,7 @@ class ApplicationController < ActionController::Base
def handle_with_exception def handle_with_exception
yield yield
rescue ActiveRecord::RecordNotFound => e rescue ActiveRecord::RecordNotFound => e
Raven.capture_exception(e) Sentry.capture_exception(e)
render_not_found_error('Resource could not be found') render_not_found_error('Resource could not be found')
rescue Pundit::NotAuthorizedError rescue Pundit::NotAuthorizedError
render_unauthorized('You are not authorized to do this action') render_unauthorized('You are not authorized to do this action')

View File

@@ -1,8 +1,8 @@
module AuthHelper module AuthHelper
def send_auth_headers(user) def send_auth_headers(user)
data = user.create_new_auth_token data = user.create_new_auth_token
response.headers[DeviseTokenAuth.headers_names[:"access-token"]] = data['access-token'] response.headers[DeviseTokenAuth.headers_names[:'access-token']] = data['access-token']
response.headers[DeviseTokenAuth.headers_names[:"token-type"]] = 'Bearer' response.headers[DeviseTokenAuth.headers_names[:'token-type']] = 'Bearer'
response.headers[DeviseTokenAuth.headers_names[:client]] = data['client'] response.headers[DeviseTokenAuth.headers_names[:client]] = data['client']
response.headers[DeviseTokenAuth.headers_names[:expiry]] = data['expiry'] response.headers[DeviseTokenAuth.headers_names[:expiry]] = data['expiry']
response.headers[DeviseTokenAuth.headers_names[:uid]] = data['uid'] response.headers[DeviseTokenAuth.headers_names[:uid]] = data['uid']

View File

@@ -14,7 +14,7 @@ class Public::Api::V1::Inboxes::MessagesController < Public::Api::V1::InboxesCon
def update def update
@message.update!(message_update_params) @message.update!(message_update_params)
rescue StandardError => e rescue StandardError => e
render json: { error: @contact.errors, message: e.message }.to_json, status: 500 render json: { error: @contact.errors, message: e.message }.to_json, status: :internal_server_error
end end
private private

View File

@@ -3,7 +3,7 @@ class SwaggerController < ApplicationController
if Rails.env.development? || Rails.env.test? if Rails.env.development? || Rails.env.test?
render inline: File.read(Rails.root.join('swagger', derived_path)) render inline: File.read(Rails.root.join('swagger', derived_path))
else else
head 404 head :not_found
end end
end end

View File

@@ -45,7 +45,7 @@ class ContactIpLookupJob < ApplicationJob
def setup_vendor_db def setup_vendor_db
base_url = 'https://download.maxmind.com/app/geoip_download' base_url = 'https://download.maxmind.com/app/geoip_download'
source = URI.open("#{base_url}?edition_id=GeoLite2-City&suffix=tar.gz&license_key=#{ENV['IP_LOOKUP_API_KEY']}") source = URI.parse("#{base_url}?edition_id=GeoLite2-City&suffix=tar.gz&license_key=#{ENV['IP_LOOKUP_API_KEY']}").open
tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(source)) tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(source))
tar_extract.rewind tar_extract.rewind

View File

@@ -9,7 +9,7 @@ class HookJob < ApplicationJob
process_dialogflow_integration(hook, event_name, event_data) process_dialogflow_integration(hook, event_name, event_data)
end end
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
end end
private private

View File

@@ -1,7 +1,7 @@
class ApplicationMailbox < ActionMailbox::Base class ApplicationMailbox < ActionMailbox::Base
# Last part is the regex for the UUID # Last part is the regex for the UUID
# Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com # Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com
REPLY_EMAIL_USERNAME_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze REPLY_EMAIL_USERNAME_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i
def self.reply_mail? def self.reply_mail?
proc do |inbound_mail_obj| proc do |inbound_mail_obj|

View File

@@ -5,7 +5,7 @@ class ReplyMailbox < ApplicationMailbox
# Last part is the regex for the UUID # Last part is the regex for the UUID
# Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com # Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com
EMAIL_PART_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze EMAIL_PART_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i
before_processing :conversation_uuid_from_to_address, before_processing :conversation_uuid_from_to_address,
:verify_decoded_params, :verify_decoded_params,

View File

@@ -47,14 +47,14 @@ class Channel::FacebookPage < ApplicationRecord
] ]
) )
rescue => e rescue => e
Rails.logger.debug "Rescued: #{e.inspect}" Rails.logger.debug { "Rescued: #{e.inspect}" }
true true
end end
def unsubscribe def unsubscribe
Facebook::Messenger::Subscriptions.unsubscribe(access_token: page_access_token) Facebook::Messenger::Subscriptions.unsubscribe(access_token: page_access_token)
rescue => e rescue => e
Rails.logger.debug "Rescued: #{e.inspect}" Rails.logger.debug { "Rescued: #{e.inspect}" }
true true
end end
end end

View File

@@ -31,7 +31,7 @@ class ContentAttributeValidator < ActiveModel::Validator
end end
def validate_item_attributes!(record, valid_keys) def validate_item_attributes!(record, valid_keys)
item_keys = record.items.collect(&:keys).flatten.map(&:to_sym).compact item_keys = record.items.collect(&:keys).flatten.filter_map(&:to_sym)
invalid_keys = item_keys - valid_keys invalid_keys = item_keys - valid_keys
record.errors.add(:content_attributes, "contains invalid keys for items : #{invalid_keys}") if invalid_keys.present? record.errors.add(:content_attributes, "contains invalid keys for items : #{invalid_keys}") if invalid_keys.present?
end end

View File

@@ -38,8 +38,6 @@ class Integrations::App
case params[:id] case params[:id]
when 'slack' when 'slack'
ENV['SLACK_CLIENT_SECRET'].present? ENV['SLACK_CLIENT_SECRET'].present?
when 'dialogflow', 'fullcontact'
true
else else
true true
end end

View File

@@ -105,7 +105,7 @@ class Message < ApplicationRecord
def merge_sender_attributes(data) def merge_sender_attributes(data)
data.merge!(sender: sender.push_event_data) if sender && !sender.is_a?(AgentBot) data.merge!(sender: sender.push_event_data) if sender && !sender.is_a?(AgentBot)
data.merge!(sender: sender.push_event_data(inbox)) if sender&.is_a?(AgentBot) data.merge!(sender: sender.push_event_data(inbox)) if sender.is_a?(AgentBot)
data data
end end
@@ -142,7 +142,7 @@ class Message < ApplicationRecord
end end
def update_contact_activity def update_contact_activity
sender.update(last_activity_at: DateTime.now) if sender&.is_a?(Contact) sender.update(last_activity_at: DateTime.now) if sender.is_a?(Contact)
end end
def dispatch_create_events def dispatch_create_events

View File

@@ -38,7 +38,7 @@ class MailPresenter < SimpleDelegator
def attachments def attachments
# ref : https://github.com/gorails-screencasts/action-mailbox-action-text/blob/master/app/mailboxes/posts_mailbox.rb # ref : https://github.com/gorails-screencasts/action-mailbox-action-text/blob/master/app/mailboxes/posts_mailbox.rb
mail.attachments.map do |attachment| mail.attachments.map do |attachment|
blob = ActiveStorage::Blob.create_after_upload!( blob = ActiveStorage::Blob.create_and_upload!(
io: StringIO.new(attachment.body.to_s), io: StringIO.new(attachment.body.to_s),
filename: attachment.filename, filename: attachment.filename,
content_type: attachment.content_type content_type: attachment.content_type

View File

@@ -3,7 +3,7 @@ class Contacts::ContactableInboxesService
def get def get
account = contact.account account = contact.account
account.inboxes.map { |inbox| get_contactable_inbox(inbox) }.compact account.inboxes.filter_map { |inbox| get_contactable_inbox(inbox) }
end end
private private

View File

@@ -7,7 +7,7 @@ class MessageTemplates::Template::EmailCollect
conversation.messages.create!(email_input_box_template_message_params) conversation.messages.create!(email_input_box_template_message_params)
end end
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
true true
end end

View File

@@ -6,7 +6,7 @@ class MessageTemplates::Template::Greeting
conversation.messages.create!(greeting_message_params) conversation.messages.create!(greeting_message_params)
end end
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
true true
end end

View File

@@ -6,7 +6,7 @@ class MessageTemplates::Template::OutOfOffice
conversation.messages.create!(out_of_office_message_params) conversation.messages.create!(out_of_office_message_params)
end end
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
true true
end end

View File

@@ -16,4 +16,4 @@
<% row = [ agent.name, agent_report[:conversations_count], (agent_report[:avg_first_response_time]/60).to_i, (agent_report[:avg_resolution_time]/60).to_i ] %> <% row = [ agent.name, agent_report[:conversations_count], (agent_report[:avg_first_response_time]/60).to_i, (agent_report[:avg_resolution_time]/60).to_i ] %>
<%= CSV.generate_line row %> <%= CSV.generate_line row %>
<% end %> <% end %>
<%= CSV.generate_line [I18n.t('reports.period', { since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s') })] %> <%= CSV.generate_line [I18n.t('reports.period', since: Date.strptime(params[:since], '%s'), until: Date.strptime(params[:until], '%s'))] %>

View File

@@ -15,11 +15,6 @@ module Chatwoot
config.autoload_paths << Rails.root.join('lib') config.autoload_paths << Rails.root.join('lib')
config.eager_load_paths << Rails.root.join('lib') config.eager_load_paths << Rails.root.join('lib')
Rails.autoloaders.main.ignore(Rails.root.join('lib/azure'))
# This is required in production for zeitwerk to autoload the file
config.paths.add File.join('app', 'bot'), glob: File.join('**', '*.rb')
config.autoload_paths << Rails.root.join('app/bot/*')
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers

View File

@@ -0,0 +1 @@
ActiveRecordQueryTrace.enabled = true if Rails.env.development?

View File

@@ -16,4 +16,5 @@ Rails.application.config.assets.precompile += %w[dashboardChart.js]
# to take care of fonts in assets pre-compiling # to take care of fonts in assets pre-compiling
# Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy # Ref: https://stackoverflow.com/questions/56960709/rails-font-cors-policy
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf|woff2)$/ # https://github.com/rails/sprockets/issues/632#issuecomment-551324428
Rails.application.config.assets.precompile << ['*.svg', '*.eot', '*.woff', '*.ttf']

View File

@@ -1,170 +0,0 @@
# TODO: Remove this once the changes comes into rails version
# https://github.com/Azure/azure-storage-ruby/issues/166#issuecomment-637696565
# Remove this once the changes comes into rails version
# code from current master : https://github.com/rails/rails/blob/8520cc77133d9ff642e2c393b4ee5eae2a2a28b6/activestorage/lib/active_storage/service/azure_storage_service.rb
require 'azure/storage/blob'
require 'active_storage/service/azure_storage_service'
module ActiveStorage
# Wraps the Microsoft Azure Storage Blob Service as an Active Storage service.
# See ActiveStorage::Service for the generic API documentation that applies to all services.
class Service::AzureStorageService < Service
attr_reader :client, :container, :signer
def initialize(storage_account_name:, storage_access_key:, container:, public: false, **options)
@client = Azure::Storage::Blob::BlobService.create(storage_account_name: storage_account_name, storage_access_key: storage_access_key, **options)
@signer = Azure::Storage::Common::Core::Auth::SharedAccessSignature.new(storage_account_name, storage_access_key)
@container = container
@public = public
end
def upload(key, io, checksum: nil, filename: nil, content_type: nil, disposition: nil, **)
instrument :upload, key: key, checksum: checksum do
handle_errors do
content_disposition = content_disposition_with(filename: filename, type: disposition) if disposition && filename
client.create_block_blob(container, key, IO.try_convert(io) || io, content_md5: checksum, content_type: content_type, content_disposition: content_disposition)
end
end
end
def download(key, &block)
if block_given?
instrument :streaming_download, key: key do
stream(key, &block)
end
else
instrument :download, key: key do
handle_errors do
_, io = client.get_blob(container, key)
io.force_encoding(Encoding::BINARY)
end
end
end
end
def download_chunk(key, range)
instrument :download_chunk, key: key, range: range do
handle_errors do
_, io = client.get_blob(container, key, start_range: range.begin, end_range: range.exclude_end? ? range.end - 1 : range.end)
io.force_encoding(Encoding::BINARY)
end
end
end
def delete(key)
instrument :delete, key: key do
client.delete_blob(container, key)
rescue Azure::Core::Http::HTTPError => e
raise unless e.type == "BlobNotFound"
# Ignore files already deleted
end
end
def delete_prefixed(prefix)
instrument :delete_prefixed, prefix: prefix do
marker = nil
loop do
results = client.list_blobs(container, prefix: prefix, marker: marker)
results.each do |blob|
client.delete_blob(container, blob.name)
end
break unless marker = results.continuation_token.presence
end
end
end
def exist?(key)
instrument :exist, key: key do |payload|
answer = blob_for(key).present?
payload[:exist] = answer
answer
end
end
def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)
instrument :url, key: key do |payload|
generated_url = signer.signed_uri(
uri_for(key), false,
service: "b",
permissions: "rw",
expiry: format_expiry(expires_in)
).to_s
payload[:url] = generated_url
generated_url
end
end
def headers_for_direct_upload(key, content_type:, checksum:, filename: nil, disposition: nil, **)
content_disposition = content_disposition_with(type: disposition, filename: filename) if filename
{ "Content-Type" => content_type, "Content-MD5" => checksum, "x-ms-blob-content-disposition" => content_disposition, "x-ms-blob-type" => "BlockBlob" }
end
private
def private_url(key, expires_in:, filename:, disposition:, content_type:, **)
signer.signed_uri(
uri_for(key), false,
service: "b",
permissions: "r",
expiry: format_expiry(expires_in),
content_disposition: content_disposition_with(type: disposition, filename: filename),
content_type: content_type
).to_s
end
def public_url(key, **)
uri_for(key).to_s
end
def uri_for(key)
client.generate_uri("#{container}/#{key}")
end
def blob_for(key)
client.get_blob_properties(container, key)
rescue Azure::Core::Http::HTTPError
false
end
def format_expiry(expires_in)
expires_in ? Time.now.utc.advance(seconds: expires_in).iso8601 : nil
end
# Reads the object for the given key in chunks, yielding each to the block.
def stream(key)
blob = blob_for(key)
chunk_size = 5.megabytes
offset = 0
raise ActiveStorage::FileNotFoundError unless blob.present?
while offset < blob.properties[:content_length]
_, chunk = client.get_blob(container, key, start_range: offset, end_range: offset + chunk_size - 1)
yield chunk.force_encoding(Encoding::BINARY)
offset += chunk_size
end
end
def handle_errors
yield
rescue Azure::Core::Http::HTTPError => e
case e.type
when "BlobNotFound"
raise ActiveStorage::FileNotFoundError
when "Md5Mismatch"
raise ActiveStorage::IntegrityError
else
raise
end
end
end
end

View File

@@ -1,41 +0,0 @@
# Remember that Rails only eager loads everything in its production environment.
# In the development and test environments, it only requires files as you reference constants.
# You'll need to explicitly load app/bot
unless Rails.env.production?
bot_files = Dir[Rails.root.join('app', 'bot', '**', '*.rb')]
bot_reloader = ActiveSupport::FileUpdateChecker.new(bot_files) do
bot_files.each { |file| require_dependency file }
end
ActiveSupport::Reloader.to_prepare do
bot_reloader.execute_if_updated
end
bot_files.each { |file| require_dependency file }
end
# ref: https://github.com/jgorset/facebook-messenger#make-a-configuration-provider
class ChatwootFbProvider < Facebook::Messenger::Configuration::Providers::Base
def valid_verify_token?(_verify_token)
ENV['FB_VERIFY_TOKEN']
end
def app_secret_for(_page_id)
ENV['FB_APP_SECRET']
end
def access_token_for(page_id)
Channel::FacebookPage.where(page_id: page_id).last.page_access_token
end
private
def bot
Chatwoot::Bot
end
end
Facebook::Messenger.configure do |config|
config.provider = ChatwootFbProvider.new
end

View File

@@ -1,6 +1,29 @@
require 'facebook/messenger' # ref: https://github.com/jgorset/facebook-messenger#make-a-configuration-provider
class ChatwootFbProvider < Facebook::Messenger::Configuration::Providers::Base
def valid_verify_token?(_verify_token)
ENV['FB_VERIFY_TOKEN']
end
def app_secret_for(_page_id)
ENV['FB_APP_SECRET']
end
def access_token_for(page_id)
Channel::FacebookPage.where(page_id: page_id).last.page_access_token
end
private
def bot
Chatwoot::Bot
end
end
Rails.application.reloader.to_prepare do
Facebook::Messenger.configure do |config|
config.provider = ChatwootFbProvider.new
end
class FacebookBot
Facebook::Messenger::Bot.on :message do |message| Facebook::Messenger::Bot.on :message do |message|
Rails.logger.info "MESSAGE_RECIEVED #{message}" Rails.logger.info "MESSAGE_RECIEVED #{message}"
response = ::Integrations::Facebook::MessageParser.new(message) response = ::Integrations::Facebook::MessageParser.new(message)

View File

@@ -1,28 +1,4 @@
Raven.configure do |config| Sentry.init do |config|
config.dsn = ENV['SENTRY_DSN'] config.dsn = ENV['SENTRY_DSN']
config.environments = %w[staging production] config.enabled_environments = %w[staging production]
end end
module QueryTrace
def self.enable!
::ActiveRecord::LogSubscriber.send(:include, self)
end
def self.append_features(klass)
super
klass.class_eval do
unless method_defined?(:log_info_without_trace)
alias_method :log_info_without_trace, :sql
alias_method :sql, :log_info_with_trace
end
end
end
def log_info_with_trace(event)
log_info_without_trace(event)
trace_log = Rails.backtrace_cleaner.clean(caller).first
logger.debug(" \\_ \e[33mCalled from:\e[0m #{trace_log}") if trace_log && event.payload[:name] != 'SCHEMA'
end
end
QueryTrace.enable! unless Rails.env.production?

View File

@@ -15,9 +15,7 @@ class AddSenderToMessages < ActiveRecord::Migration[6.0]
# rubocop:disable Rails/SkipsModelValidations # rubocop:disable Rails/SkipsModelValidations
message.update_columns(sender_id: message.user.id, sender_type: 'User') if message.user.present? message.update_columns(sender_id: message.user.id, sender_type: 'User') if message.user.present?
message.update_columns(sender_id: message.contact.id, sender_type: 'Contact') if message.contact.present? message.update_columns(sender_id: message.contact.id, sender_type: 'Contact') if message.contact.present?
if message.sender.nil? message.update_columns(sender_id: message.conversation.contact.id, sender_type: 'Contact') if message.sender.nil? && message.incoming?
message.update_columns(sender_id: message.conversation.contact.id, sender_type: 'Contact') if message.incoming?
end
# rubocop:enable Rails/SkipsModelValidations # rubocop:enable Rails/SkipsModelValidations
end end
end end

View File

@@ -0,0 +1,18 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
remove_column :active_storage_blobs, :service_name
end
end

View File

@@ -0,0 +1,12 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.index %i[blob_id variation_digest], name: 'index_active_storage_variant_records_uniqueness', unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end

View File

@@ -2,8 +2,8 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# This file is the source Rails uses to define your schema when running `rails # This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your # be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those # migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code. # migrations use external dependencies or application code.
@@ -79,9 +79,16 @@ ActiveRecord::Schema.define(version: 2021_07_23_095657) do
t.bigint "byte_size", null: false t.bigint "byte_size", null: false
t.string "checksum", null: false t.string "checksum", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.string "service_name", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end end
create_table "active_storage_variant_records", force: :cascade do |t|
t.bigint "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
create_table "agent_bot_inboxes", force: :cascade do |t| create_table "agent_bot_inboxes", force: :cascade do |t|
t.integer "inbox_id" t.integer "inbox_id"
t.integer "agent_bot_id" t.integer "agent_bot_id"
@@ -685,6 +692,7 @@ ActiveRecord::Schema.define(version: 2021_07_23_095657) do
add_foreign_key "account_users", "accounts" add_foreign_key "account_users", "accounts"
add_foreign_key "account_users", "users" add_foreign_key "account_users", "users"
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "agent_bots", "accounts" add_foreign_key "agent_bots", "accounts"
add_foreign_key "campaigns", "accounts" add_foreign_key "campaigns", "accounts"
add_foreign_key "campaigns", "inboxes" add_foreign_key "campaigns", "inboxes"

View File

@@ -16,10 +16,10 @@ KillMode=mixed
StandardInput=null StandardInput=null
SyslogIdentifier=%p SyslogIdentifier=%p
Environment="PATH=/home/chatwoot/.rvm/gems/ruby-2.7.3/bin:/home/chatwoot/.rvm/gems/ruby-2.7.3@global/bin:/home/chatwoot/.rvm/rubies/ruby-2.7.3/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.0.2/bin:/home/chatwoot/.rvm/gems/ruby-3.0.2@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.0.2/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin"
Environment="PORT=3000" Environment="PORT=3000"
Environment="RAILS_ENV=production" Environment="RAILS_ENV=production"
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
Environment="RAILS_LOG_TO_STDOUT=true" Environment="RAILS_LOG_TO_STDOUT=true"
Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-2.7.3" Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.0.2"
Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-2.7.3:/home/chatwoot/.rvm/gems/ruby-2.7.3@global" Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.0.2:/home/chatwoot/.rvm/gems/ruby-3.0.2@global"

View File

@@ -16,10 +16,10 @@ KillMode=mixed
StandardInput=null StandardInput=null
SyslogIdentifier=%p SyslogIdentifier=%p
Environment="PATH=/home/chatwoot/.rvm/gems/ruby-2.7.3/bin:/home/chatwoot/.rvm/gems/ruby-2.7.3@global/bin:/home/chatwoot/.rvm/rubies/ruby-2.7.3/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.0.2/bin:/home/chatwoot/.rvm/gems/ruby-3.0.2@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.0.2/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin"
Environment="PORT=3000" Environment="PORT=3000"
Environment="RAILS_ENV=production" Environment="RAILS_ENV=production"
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
Environment="RAILS_LOG_TO_STDOUT=true" Environment="RAILS_LOG_TO_STDOUT=true"
Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-2.7.3" Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.0.2"
Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-2.7.3:/home/chatwoot/.rvm/gems/ruby-2.7.3@global" Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.0.2:/home/chatwoot/.rvm/gems/ruby-3.0.2@global"

View File

@@ -43,8 +43,8 @@ RAILS_ENV=production
sudo -i -u chatwoot << EOF sudo -i -u chatwoot << EOF
rvm --version rvm --version
rvm autolibs disable rvm autolibs disable
rvm install "ruby-2.7.3" rvm install "ruby-3.0.2"
rvm use 2.7.3 --default rvm use 3.0.2 --default
git clone https://github.com/chatwoot/chatwoot.git git clone https://github.com/chatwoot/chatwoot.git
cd chatwoot cd chatwoot

View File

@@ -50,8 +50,8 @@ RAILS_ENV=production
sudo -i -u chatwoot << EOF sudo -i -u chatwoot << EOF
rvm --version rvm --version
rvm autolibs disable rvm autolibs disable
rvm install "ruby-2.7.3" rvm install "ruby-3.0.2"
rvm use 2.7.3 --default rvm use 3.0.2 --default
git clone https://github.com/chatwoot/chatwoot.git git clone https://github.com/chatwoot/chatwoot.git
cd chatwoot cd chatwoot

View File

@@ -1,5 +1,5 @@
# pre-build stage # pre-build stage
FROM ruby:2.7.3-alpine AS pre-builder FROM ruby:3.0.2-alpine AS pre-builder
# ARG default to production settings # ARG default to production settings
# For development docker-compose file overrides ARGS # For development docker-compose file overrides ARGS
@@ -51,7 +51,7 @@ RUN if [ "$RAILS_ENV" = "production" ]; then \
fi fi
# final build stage # final build stage
FROM ruby:2.7.3-alpine FROM ruby:3.0.2-alpine
ARG BUNDLE_WITHOUT="development:test" ARG BUNDLE_WITHOUT="development:test"
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
@@ -83,9 +83,9 @@ COPY --from=pre-builder /gems/ /gems/
COPY --from=pre-builder /app /app COPY --from=pre-builder /app /app
# Remove unnecessary files # Remove unnecessary files
RUN rm -rf /gems/ruby/2.7.0/cache/*.gem \ RUN rm -rf /gems/ruby/3.0.2/cache/*.gem \
&& find /gems/ruby/2.7.0/gems/ -name "*.c" -delete \ && find /gems/ruby/3.0.2/gems/ -name "*.c" -delete \
&& find /gems/ruby/2.7.0/gems/ -name "*.o" -delete && find /gems/ruby/3.0.2/gems/ -name "*.o" -delete
# creating a log directory so that image wont fail when RAILS_LOG_TO_STDOUT is false # creating a log directory so that image wont fail when RAILS_LOG_TO_STDOUT is false
# https://github.com/chatwoot/chatwoot/issues/701 # https://github.com/chatwoot/chatwoot/issues/701

View File

@@ -1,2 +0,0 @@
# https://github.com/Azure/azure-storage-ruby/issues/166#issuecomment-637696565
# Remove this once the changes comes into rails

View File

@@ -1,2 +0,0 @@
# TODO: Remove this once the changes comes into rails version
# https://github.com/Azure/azure-storage-ruby/issues/166#issuecomment-637696565

View File

@@ -39,7 +39,7 @@ class ChatwootHub
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "Exception: #{e.message}" Rails.logger.info "Exception: #{e.message}"
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
end end
version version
end end
@@ -61,6 +61,6 @@ class ChatwootHub
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "Exception: #{e.message}" Rails.logger.info "Exception: #{e.message}"
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
end end
end end

View File

@@ -1,5 +1,5 @@
module ExceptionList module ExceptionList
URI_EXCEPTIONS = [Errno::ETIMEDOUT, Errno::ECONNREFUSED, URI::InvalidURIError, Net::OpenTimeout, SocketError, OpenURI::HTTPError].freeze URI_EXCEPTIONS = [Errno::ETIMEDOUT, Errno::ECONNREFUSED, URI::InvalidURIError, Net::OpenTimeout, SocketError].freeze
REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest, REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest,
RestClient::MethodNotAllowed, RestClient::Forbidden, RestClient::InternalServerError, RestClient::PayloadTooLarge].freeze RestClient::MethodNotAllowed, RestClient::Forbidden, RestClient::InternalServerError, RestClient::PayloadTooLarge].freeze
SMTP_EXCEPTIONS = [ SMTP_EXCEPTIONS = [

View File

@@ -15,7 +15,7 @@ class Integrations::Facebook::MessageCreator
create_contact_message create_contact_message
end end
# rescue => e # rescue => e
# Raven.capture_exception(e) # Sentry.capture_exception(e)
# end # end
end end

View File

@@ -9,6 +9,6 @@ class Webhooks::Trigger
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "Exception: invalid webhook url #{url} : #{e.message}" Rails.logger.info "Exception: invalid webhook url #{url} : #{e.message}"
rescue StandardError => e rescue StandardError => e
Raven.capture_exception(e) Sentry.capture_exception(e)
end end
end end

View File

@@ -91,15 +91,15 @@ module WootMessageSeeder
def self.sample_form def self.sample_form
{ {
"items": [ items: [
{ "name": 'email', "placeholder": 'Please enter your email', "type": 'email', "label": 'Email', "required": 'required', { name: 'email', placeholder: 'Please enter your email', type: 'email', label: 'Email', required: 'required',
"pattern_error": 'Please fill this field', "pattern": '^[^\s@]+@[^\s@]+\.[^\s@]+$' }, pattern_error: 'Please fill this field', pattern: '^[^\s@]+@[^\s@]+\.[^\s@]+$' },
{ "name": 'text_area', "placeholder": 'Please enter text', "type": 'text_area', "label": 'Large Text', "required": 'required', { name: 'text_area', placeholder: 'Please enter text', type: 'text_area', label: 'Large Text', required: 'required',
"pattern_error": 'Please fill this field' }, pattern_error: 'Please fill this field' },
{ "name": 'text', "placeholder": 'Please enter text', "type": 'text', "label": 'text', "default": 'defaut value', "required": 'required', { name: 'text', placeholder: 'Please enter text', type: 'text', label: 'text', default: 'defaut value', required: 'required',
"pattern": '^[a-zA-Z ]*$', "pattern_error": 'Only alphabets are allowed' }, pattern: '^[a-zA-Z ]*$', pattern_error: 'Only alphabets are allowed' },
{ "name": 'select', "label": 'Select Option', "type": 'select', "options": [{ "label": '🌯 Burito', "value": 'Burito' }, { name: 'select', label: 'Select Option', type: 'select', options: [{ label: '🌯 Burito', value: 'Burito' },
{ "label": '🍝 Pasta', "value": 'Pasta' }] } { label: '🍝 Pasta', value: 'Pasta' }] }
] ]
} }
end end

View File

@@ -8,9 +8,11 @@ describe ::ContactMergeAction do
let!(:mergee_contact) { create(:contact, account: account) } let!(:mergee_contact) { create(:contact, account: account) }
before do before do
2.times.each { create(:conversation, contact: base_contact) } 2.times.each do
2.times.each { create(:conversation, contact: mergee_contact) } create(:conversation, contact: base_contact)
2.times.each { create(:message, sender: mergee_contact) } create(:conversation, contact: mergee_contact)
create(:message, sender: mergee_contact)
end
end end
describe '#perform' do describe '#perform' do

View File

@@ -13,8 +13,10 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/conversations', type:
before do before do
create(:inbox_member, user: agent, inbox: inbox_1) create(:inbox_member, user: agent, inbox: inbox_1)
2.times.each { create(:conversation, account: account, inbox: inbox_1, contact: contact, contact_inbox: contact_inbox_1) } 2.times.each do
2.times.each { create(:conversation, account: account, inbox: inbox_2, contact: contact, contact_inbox: contact_inbox_2) } create(:conversation, account: account, inbox: inbox_1, contact: contact, contact_inbox: contact_inbox_1)
create(:conversation, account: account, inbox: inbox_2, contact: contact, contact_inbox: contact_inbox_2)
end
end end
describe 'GET /api/v1/accounts/{account.id}/contacts/:id/conversations' do describe 'GET /api/v1/accounts/{account.id}/contacts/:id/conversations' do

View File

@@ -3,7 +3,7 @@ FactoryBot.define do
app_id { 'slack' } app_id { 'slack' }
inbox inbox
account account
settings { { 'test': 'test' } } settings { { test: 'test' } }
status { Integrations::Hook.statuses['enabled'] } status { Integrations::Hook.statuses['enabled'] }
access_token { SecureRandom.hex } access_token { SecureRandom.hex }
reference_id { SecureRandom.hex } reference_id { SecureRandom.hex }

View File

@@ -23,7 +23,7 @@ require 'sidekiq/testing'
# require only the support files necessary. # require only the support files necessary.
# #
# rubocop:disable Rails/FilePath # rubocop:disable Rails/FilePath
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
# rubocop:enable Rails/FilePath # rubocop:enable Rails/FilePath
# Checks for pending migrations and applies them before tests are run. # Checks for pending migrations and applies them before tests are run.
@@ -79,4 +79,5 @@ end
# Required for fixture_file_upload # Required for fixture_file_upload
FactoryBot::SyntaxRunner.class_eval do FactoryBot::SyntaxRunner.class_eval do
include ActionDispatch::TestProcess include ActionDispatch::TestProcess
include ActiveSupport::Testing::FileFixtures
end end

View File

@@ -1,75 +1,76 @@
module SlackStubs module SlackStubs
def slack_url_verification_stub def slack_url_verification_stub
{ {
"token": 'Jhj5dZrVaK7ZwHHjRyZWjbDl', token: 'Jhj5dZrVaK7ZwHHjRyZWjbDl',
"challenge": '3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P', challenge: '3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P',
"type": 'url_verification' type: 'url_verification'
} }
end end
def slack_message_stub def slack_message_stub
{ {
"token": '[FILTERED]', token: '[FILTERED]',
"team_id": 'TLST3048H', team_id: 'TLST3048H',
"api_app_id": 'A012S5UETV4', api_app_id: 'A012S5UETV4',
"event": message_event, event: message_event,
"type": 'event_callback', type: 'event_callback',
"event_id": 'Ev013QUX3WV6', event_id: 'Ev013QUX3WV6',
"event_time": 1_588_623_033, event_time: 1_588_623_033,
"authed_users": '[FILTERED]', authed_users: '[FILTERED]',
"webhook": {} webhook: {}
} }
end end
def slack_message_stub_without_thread_ts def slack_message_stub_without_thread_ts
{ {
"token": '[FILTERED]', token: '[FILTERED]',
"team_id": '', team_id: '',
"api_app_id": '', api_app_id: '',
"event": { event: {
"type": 'message', type: 'message',
"client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab', client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
"text": 'this is test', text: 'this is test',
"user": 'ULYPAKE5S', user: 'ULYPAKE5S',
"ts": '1588623033.006000', ts: '1588623033.006000',
"team": 'TLST3048H' team: 'TLST3048H'
}, },
"type": 'event_callback', type: 'event_callback',
"event_id": '', event_id: '',
"event_time": 1_588_623_033, event_time: 1_588_623_033,
"authed_users": '[FILTERED]', authed_users: '[FILTERED]',
"webhook": {} webhook: {}
} }
end end
def message_event def message_event
{ {
"client_msg_id": 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
"type": 'message', client_msg_id: 'ffc6e64e-6f0c-4a3d-b594-faa6b44e48ab',
"text": 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again', type: 'message',
"user": 'ULYPAKE5S', text: 'this is test <https://chatwoot.com> Hey <@U019KT237LP|Sojan> Test again',
"ts": '1588623033.006000', user: 'ULYPAKE5S',
"team": 'TLST3048H', ts: '1588623033.006000',
"blocks": message_blocks, team: 'TLST3048H',
"thread_ts": '1588623023.005900', blocks: message_blocks,
"channel": 'G01354F6A6Q', thread_ts: '1588623023.005900',
"event_ts": '1588623033.006000', channel: 'G01354F6A6Q',
"channel_type": 'group' event_ts: '1588623033.006000',
channel_type: 'group'
} }
end end
def message_blocks def message_blocks
[ [
{ {
"type": 'rich_text', type: 'rich_text',
"block_id": 'jaIv3', block_id: 'jaIv3',
"elements": [ elements: [
{ {
"type": 'rich_text_section', type: 'rich_text_section',
"elements": [ elements: [
{ {
"type": 'text', type: 'text',
"text": 'this is test' text: 'this is test'
} }
] ]
} }