mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	chore: Update dependencies to the latest versions (#5033)
This commit is contained in:
		| @@ -93,15 +93,18 @@ jobs: | ||||
|       - run: bundle exec rake db:create | ||||
|       - run: bundle exec rake db:schema:load | ||||
|  | ||||
|       # disable till fixed | ||||
|       # - run: | ||||
|       #     name: Bundle audit | ||||
|       #     command: bundle exec bundle audit update && bundle exec bundle audit check -v | ||||
|       - run: | ||||
|           name: Bundle audit | ||||
|           command: bundle exec bundle audit update && bundle exec bundle audit check -v | ||||
|  | ||||
|       - run: | ||||
|           name: Rubocop | ||||
|           command: bundle exec rubocop | ||||
|        | ||||
|       # - run: | ||||
|       #     name: Brakeman | ||||
|       #     command: bundle exec brakeman | ||||
|  | ||||
|       - run: | ||||
|           name: eslint | ||||
|           command: yarn run eslint | ||||
|   | ||||
							
								
								
									
										9
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								Gemfile
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ ruby '3.0.4' | ||||
|  | ||||
| ##-- base gems for rails --## | ||||
| gem 'rack-cors', require: 'rack/cors' | ||||
| gem 'rails' | ||||
| gem 'rails', '~>6.1' | ||||
| # Reduces boot times through caching; required in config/boot.rb | ||||
| gem 'bootsnap', require: false | ||||
|  | ||||
| @@ -89,10 +89,6 @@ gem 'slack-ruby-client' | ||||
| # for dialogflow integrations | ||||
| gem 'google-cloud-dialogflow' | ||||
|  | ||||
| ##--- gems for debugging and error reporting ---## | ||||
| # static analysis | ||||
| gem 'brakeman' | ||||
|  | ||||
| ##-- apm and error monitoring ---# | ||||
| gem 'ddtrace' | ||||
| gem 'newrelic_rpm' | ||||
| @@ -160,6 +156,9 @@ end | ||||
|  | ||||
| group :development, :test do | ||||
|   gem 'active_record_query_trace' | ||||
|   ##--- gems for debugging and error reporting ---## | ||||
|   # static analysis | ||||
|   gem 'brakeman' | ||||
|   gem 'bundle-audit', require: false | ||||
|   gem 'byebug', platform: :mri | ||||
|   gem 'climate_control' | ||||
|   | ||||
							
								
								
									
										405
									
								
								Gemfile.lock
									
									
									
									
									
								
							
							
						
						
									
										405
									
								
								Gemfile.lock
									
									
									
									
									
								
							| @@ -9,63 +9,63 @@ GIT | ||||
| GEM | ||||
|   remote: https://rubygems.org/ | ||||
|   specs: | ||||
|     actioncable (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actioncable (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       nio4r (~> 2.0) | ||||
|       websocket-driver (>= 0.6.1) | ||||
|     actionmailbox (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       activejob (= 6.1.5.1) | ||||
|       activerecord (= 6.1.5.1) | ||||
|       activestorage (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actionmailbox (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       activejob (= 6.1.6.1) | ||||
|       activerecord (= 6.1.6.1) | ||||
|       activestorage (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       mail (>= 2.7.1) | ||||
|     actionmailer (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       actionview (= 6.1.5.1) | ||||
|       activejob (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actionmailer (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       actionview (= 6.1.6.1) | ||||
|       activejob (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       mail (~> 2.5, >= 2.5.4) | ||||
|       rails-dom-testing (~> 2.0) | ||||
|     actionpack (6.1.5.1) | ||||
|       actionview (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actionpack (6.1.6.1) | ||||
|       actionview (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       rack (~> 2.0, >= 2.0.9) | ||||
|       rack-test (>= 0.6.3) | ||||
|       rails-dom-testing (~> 2.0) | ||||
|       rails-html-sanitizer (~> 1.0, >= 1.2.0) | ||||
|     actiontext (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       activerecord (= 6.1.5.1) | ||||
|       activestorage (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actiontext (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       activerecord (= 6.1.6.1) | ||||
|       activestorage (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       nokogiri (>= 1.8.5) | ||||
|     actionview (6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     actionview (6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       builder (~> 3.1) | ||||
|       erubi (~> 1.4) | ||||
|       rails-dom-testing (~> 2.0) | ||||
|       rails-html-sanitizer (~> 1.1, >= 1.2.0) | ||||
|     active_record_query_trace (1.8) | ||||
|     activejob (6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     activejob (6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       globalid (>= 0.3.6) | ||||
|     activemodel (6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     activerecord (6.1.5.1) | ||||
|       activemodel (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     activerecord-import (1.3.0) | ||||
|     activemodel (6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|     activerecord (6.1.6.1) | ||||
|       activemodel (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|     activerecord-import (1.4.0) | ||||
|       activerecord (>= 4.2) | ||||
|     activestorage (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       activejob (= 6.1.5.1) | ||||
|       activerecord (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     activestorage (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       activejob (= 6.1.6.1) | ||||
|       activerecord (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       marcel (~> 1.0) | ||||
|       mini_mime (>= 1.1.0) | ||||
|     activesupport (6.1.5.1) | ||||
|     activesupport (6.1.6.1) | ||||
|       concurrent-ruby (~> 1.0, >= 1.0.2) | ||||
|       i18n (>= 1.6, < 2) | ||||
|       minitest (>= 5.1) | ||||
| @@ -91,20 +91,20 @@ GEM | ||||
|     ast (2.4.2) | ||||
|     attr_extras (6.2.5) | ||||
|     aws-eventstream (1.2.0) | ||||
|     aws-partitions (1.556.0) | ||||
|     aws-sdk-core (3.126.2) | ||||
|     aws-partitions (1.605.0) | ||||
|     aws-sdk-core (3.131.2) | ||||
|       aws-eventstream (~> 1, >= 1.0.2) | ||||
|       aws-partitions (~> 1, >= 1.525.0) | ||||
|       aws-sigv4 (~> 1.1) | ||||
|       jmespath (~> 1.0) | ||||
|     aws-sdk-kms (1.54.0) | ||||
|       aws-sdk-core (~> 3, >= 3.126.0) | ||||
|       jmespath (~> 1, >= 1.6.1) | ||||
|     aws-sdk-kms (1.57.0) | ||||
|       aws-sdk-core (~> 3, >= 3.127.0) | ||||
|       aws-sigv4 (~> 1.1) | ||||
|     aws-sdk-s3 (1.112.0) | ||||
|       aws-sdk-core (~> 3, >= 3.126.0) | ||||
|     aws-sdk-s3 (1.114.0) | ||||
|       aws-sdk-core (~> 3, >= 3.127.0) | ||||
|       aws-sdk-kms (~> 1) | ||||
|       aws-sigv4 (~> 1.4) | ||||
|     aws-sigv4 (1.4.0) | ||||
|     aws-sigv4 (1.5.0) | ||||
|       aws-eventstream (~> 1, >= 1.0.2) | ||||
|     azure-storage-blob (2.0.3) | ||||
|       azure-storage-common (~> 2.0) | ||||
| @@ -117,31 +117,31 @@ GEM | ||||
|     barnes (0.0.9) | ||||
|       multi_json (~> 1) | ||||
|       statsd-ruby (~> 1.1) | ||||
|     bcrypt (3.1.16) | ||||
|     bcrypt (3.1.18) | ||||
|     bindex (0.8.1) | ||||
|     bootsnap (1.10.3) | ||||
|     bootsnap (1.12.0) | ||||
|       msgpack (~> 1.2) | ||||
|     brakeman (5.2.1) | ||||
|     brakeman (5.2.3) | ||||
|     browser (5.3.1) | ||||
|     builder (3.2.4) | ||||
|     bullet (7.0.1) | ||||
|     bullet (7.0.2) | ||||
|       activesupport (>= 3.0.0) | ||||
|       uniform_notifier (~> 1.11) | ||||
|     bundle-audit (0.1.0) | ||||
|       bundler-audit | ||||
|     bundler-audit (0.9.0.1) | ||||
|     bundler-audit (0.9.1) | ||||
|       bundler (>= 1.2.0, < 3) | ||||
|       thor (~> 1.0) | ||||
|     byebug (11.1.3) | ||||
|     climate_control (1.0.1) | ||||
|     climate_control (1.1.1) | ||||
|     coderay (1.1.3) | ||||
|     commonmarker (0.23.4) | ||||
|     commonmarker (0.23.5) | ||||
|     concurrent-ruby (1.1.10) | ||||
|     connection_pool (2.2.5) | ||||
|     crack (0.4.5) | ||||
|       rexml | ||||
|     crass (1.0.6) | ||||
|     cypress-on-rails (1.12.1) | ||||
|     cypress-on-rails (1.13.1) | ||||
|       rack | ||||
|     database_cleaner (2.0.1) | ||||
|       database_cleaner-active_record (~> 2.0.0) | ||||
| @@ -151,10 +151,12 @@ GEM | ||||
|     database_cleaner-core (2.0.1) | ||||
|     datetime_picker_rails (0.0.7) | ||||
|       momentjs-rails (>= 2.8.1) | ||||
|     ddtrace (0.54.2) | ||||
|       debase-ruby_core_source (<= 0.10.14) | ||||
|     ddtrace (1.2.0) | ||||
|       debase-ruby_core_source (= 0.10.16) | ||||
|       libddprof (~> 0.6.0.1.0) | ||||
|       libddwaf (~> 1.3.0.2.0) | ||||
|       msgpack | ||||
|     debase-ruby_core_source (0.10.14) | ||||
|     debase-ruby_core_source (0.10.16) | ||||
|     declarative (0.0.20) | ||||
|     devise (4.8.1) | ||||
|       bcrypt (~> 3.0) | ||||
| @@ -176,7 +178,7 @@ GEM | ||||
|     dotenv-rails (2.7.6) | ||||
|       dotenv (= 2.7.6) | ||||
|       railties (>= 3.2) | ||||
|     down (5.3.0) | ||||
|     down (5.3.1) | ||||
|       addressable (~> 2.8) | ||||
|     ecma-re-validator (0.4.0) | ||||
|       regexp_parser (~> 2.2) | ||||
| @@ -188,36 +190,60 @@ GEM | ||||
|     facebook-messenger (2.0.1) | ||||
|       httparty (~> 0.13, >= 0.13.7) | ||||
|       rack (>= 1.4.5) | ||||
|     factory_bot (6.2.0) | ||||
|     factory_bot (6.2.1) | ||||
|       activesupport (>= 5.0.0) | ||||
|     factory_bot_rails (6.2.0) | ||||
|       factory_bot (~> 6.2.0) | ||||
|       railties (>= 5.0.0) | ||||
|     faker (2.19.0) | ||||
|       i18n (>= 1.6, < 2) | ||||
|     faraday (1.0.1) | ||||
|       multipart-post (>= 1.2, < 3) | ||||
|     faker (2.21.0) | ||||
|       i18n (>= 1.8.11, < 2) | ||||
|     faraday (1.10.0) | ||||
|       faraday-em_http (~> 1.0) | ||||
|       faraday-em_synchrony (~> 1.0) | ||||
|       faraday-excon (~> 1.1) | ||||
|       faraday-httpclient (~> 1.0) | ||||
|       faraday-multipart (~> 1.0) | ||||
|       faraday-net_http (~> 1.0) | ||||
|       faraday-net_http_persistent (~> 1.0) | ||||
|       faraday-patron (~> 1.0) | ||||
|       faraday-rack (~> 1.0) | ||||
|       faraday-retry (~> 1.0) | ||||
|       ruby2_keywords (>= 0.0.4) | ||||
|     faraday-em_http (1.0.0) | ||||
|     faraday-em_synchrony (1.0.0) | ||||
|     faraday-excon (1.1.0) | ||||
|     faraday-httpclient (1.0.1) | ||||
|     faraday-multipart (1.0.4) | ||||
|       multipart-post (~> 2) | ||||
|     faraday-net_http (1.0.1) | ||||
|     faraday-net_http_persistent (1.2.0) | ||||
|     faraday-patron (1.0.0) | ||||
|     faraday-rack (1.0.0) | ||||
|     faraday-retry (1.0.3) | ||||
|     faraday_middleware (1.2.0) | ||||
|       faraday (~> 1.0) | ||||
|     fcm (1.0.5) | ||||
|       faraday (~> 1) | ||||
|     fcm (1.0.8) | ||||
|       faraday (>= 1.0.0, < 3.0) | ||||
|       googleauth (~> 1) | ||||
|     ffi (1.15.5) | ||||
|     flag_shih_tzu (0.3.23) | ||||
|     foreman (0.87.2) | ||||
|     fugit (1.5.3) | ||||
|       et-orbi (~> 1, >= 1.2.7) | ||||
|       raabro (~> 1.4) | ||||
|     gapic-common (0.3.4) | ||||
|       google-protobuf (~> 3.12, >= 3.12.2) | ||||
|       googleapis-common-protos (>= 1.3.9, < 2.0) | ||||
|       googleapis-common-protos-types (>= 1.0.4, < 2.0) | ||||
|       googleauth (~> 0.9) | ||||
|       grpc (~> 1.25) | ||||
|     geocoder (1.7.3) | ||||
|     gapic-common (0.10.0) | ||||
|       faraday (>= 1.9, < 3.a) | ||||
|       faraday-retry (>= 1.0, < 3.a) | ||||
|       google-protobuf (~> 3.14) | ||||
|       googleapis-common-protos (>= 1.3.12, < 2.a) | ||||
|       googleapis-common-protos-types (>= 1.3.1, < 2.a) | ||||
|       googleauth (~> 1.0) | ||||
|       grpc (~> 1.36) | ||||
|     geocoder (1.8.0) | ||||
|     gli (2.21.0) | ||||
|     globalid (1.0.0) | ||||
|       activesupport (>= 5.0) | ||||
|     google-apis-core (0.4.2) | ||||
|     google-apis-core (0.7.0) | ||||
|       addressable (~> 2.5, >= 2.5.1) | ||||
|       googleauth (>= 0.16.2, < 2.a) | ||||
|       httpclient (>= 2.8.1, < 3.a) | ||||
| @@ -226,23 +252,27 @@ GEM | ||||
|       retriable (>= 2.0, < 4.a) | ||||
|       rexml | ||||
|       webrick | ||||
|     google-apis-iamcredentials_v1 (0.10.0) | ||||
|       google-apis-core (>= 0.4, < 2.a) | ||||
|     google-apis-storage_v1 (0.11.0) | ||||
|       google-apis-core (>= 0.4, < 2.a) | ||||
|     google-apis-iamcredentials_v1 (0.13.0) | ||||
|       google-apis-core (>= 0.7, < 2.a) | ||||
|     google-apis-storage_v1 (0.18.0) | ||||
|       google-apis-core (>= 0.7, < 2.a) | ||||
|     google-cloud-core (1.6.0) | ||||
|       google-cloud-env (~> 1.0) | ||||
|       google-cloud-errors (~> 1.0) | ||||
|     google-cloud-dialogflow (1.2.0) | ||||
|       google-cloud-core (~> 1.5) | ||||
|       google-cloud-dialogflow-v2 (~> 0.1) | ||||
|     google-cloud-dialogflow-v2 (0.6.4) | ||||
|       gapic-common (~> 0.3) | ||||
|     google-cloud-dialogflow (1.5.0) | ||||
|       google-cloud-core (~> 1.6) | ||||
|       google-cloud-dialogflow-v2 (>= 0.15, < 2.a) | ||||
|     google-cloud-dialogflow-v2 (0.17.0) | ||||
|       gapic-common (>= 0.10, < 2.a) | ||||
|       google-cloud-errors (~> 1.0) | ||||
|     google-cloud-env (1.5.0) | ||||
|       faraday (>= 0.17.3, < 2.0) | ||||
|       google-cloud-location (>= 0.0, < 2.a) | ||||
|     google-cloud-env (1.6.0) | ||||
|       faraday (>= 0.17.3, < 3.0) | ||||
|     google-cloud-errors (1.2.0) | ||||
|     google-cloud-storage (1.36.1) | ||||
|     google-cloud-location (0.2.0) | ||||
|       gapic-common (>= 0.10, < 2.a) | ||||
|       google-cloud-errors (~> 1.0) | ||||
|     google-cloud-storage (1.37.0) | ||||
|       addressable (~> 2.8) | ||||
|       digest-crc (~> 0.4) | ||||
|       google-apis-iamcredentials_v1 (~> 0.1) | ||||
| @@ -250,32 +280,32 @@ GEM | ||||
|       google-cloud-core (~> 1.6) | ||||
|       googleauth (>= 0.16.2, < 2.a) | ||||
|       mini_mime (~> 1.0) | ||||
|     google-protobuf (3.19.4) | ||||
|     google-protobuf (3.19.4-x86_64-darwin) | ||||
|     google-protobuf (3.19.4-x86_64-linux) | ||||
|     google-protobuf (3.21.2) | ||||
|     google-protobuf (3.21.2-x86_64-darwin) | ||||
|     google-protobuf (3.21.2-x86_64-linux) | ||||
|     googleapis-common-protos (1.3.12) | ||||
|       google-protobuf (~> 3.14) | ||||
|       googleapis-common-protos-types (~> 1.2) | ||||
|       grpc (~> 1.27) | ||||
|     googleapis-common-protos-types (1.3.0) | ||||
|     googleapis-common-protos-types (1.3.2) | ||||
|       google-protobuf (~> 3.14) | ||||
|     googleauth (0.17.1) | ||||
|       faraday (>= 0.17.3, < 2.0) | ||||
|     googleauth (1.2.0) | ||||
|       faraday (>= 0.17.3, < 3.a) | ||||
|       jwt (>= 1.4, < 3.0) | ||||
|       memoist (~> 0.16) | ||||
|       multi_json (~> 1.11) | ||||
|       os (>= 0.9, < 2.0) | ||||
|       signet (~> 0.15) | ||||
|     groupdate (6.0.1) | ||||
|       signet (>= 0.16, < 2.a) | ||||
|     groupdate (6.1.0) | ||||
|       activesupport (>= 5.2) | ||||
|     grpc (1.43.1) | ||||
|       google-protobuf (~> 3.18) | ||||
|     grpc (1.47.0) | ||||
|       google-protobuf (~> 3.19) | ||||
|       googleapis-common-protos-types (~> 1.0) | ||||
|     grpc (1.43.1-universal-darwin) | ||||
|       google-protobuf (~> 3.18) | ||||
|     grpc (1.47.0-x86_64-darwin) | ||||
|       google-protobuf (~> 3.19) | ||||
|       googleapis-common-protos-types (~> 1.0) | ||||
|     grpc (1.43.1-x86_64-linux) | ||||
|       google-protobuf (~> 3.18) | ||||
|     grpc (1.47.0-x86_64-linux) | ||||
|       google-protobuf (~> 3.19) | ||||
|       googleapis-common-protos-types (~> 1.0) | ||||
|     haikunator (1.1.1) | ||||
|     hairtrigger (0.2.25) | ||||
| @@ -289,13 +319,13 @@ GEM | ||||
|     html2text (0.2.1) | ||||
|       nokogiri (~> 1.6) | ||||
|     http-accept (1.7.0) | ||||
|     http-cookie (1.0.4) | ||||
|     http-cookie (1.0.5) | ||||
|       domain_name (~> 0.5) | ||||
|     httparty (0.20.0) | ||||
|       mime-types (~> 3.0) | ||||
|       multi_xml (>= 0.5.2) | ||||
|     httpclient (2.8.3) | ||||
|     i18n (1.10.0) | ||||
|     i18n (1.11.0) | ||||
|       concurrent-ruby (~> 1.0) | ||||
|     image_processing (1.12.2) | ||||
|       mini_magick (>= 4.9.5, < 5) | ||||
| @@ -304,19 +334,19 @@ GEM | ||||
|       actionview (>= 5.0.0) | ||||
|       activesupport (>= 5.0.0) | ||||
|     jmespath (1.6.1) | ||||
|     jquery-rails (4.4.0) | ||||
|     jquery-rails (4.5.0) | ||||
|       rails-dom-testing (>= 1, < 3) | ||||
|       railties (>= 4.2.0) | ||||
|       thor (>= 0.14, < 2.0) | ||||
|     json (2.6.1) | ||||
|     json (2.6.2) | ||||
|     json_refs (0.1.7) | ||||
|       hana | ||||
|     json_schemer (0.2.19) | ||||
|     json_schemer (0.2.21) | ||||
|       ecma-re-validator (~> 0.3) | ||||
|       hana (~> 1.3) | ||||
|       regexp_parser (~> 2.0) | ||||
|       uri_template (~> 0.7) | ||||
|     jwt (2.3.0) | ||||
|     jwt (2.4.1) | ||||
|     kaminari (1.2.2) | ||||
|       activesupport (>= 4.1.0) | ||||
|       kaminari-actionview (= 1.2.2) | ||||
| @@ -329,17 +359,27 @@ GEM | ||||
|       activerecord | ||||
|       kaminari-core (= 1.2.2) | ||||
|     kaminari-core (1.2.2) | ||||
|     koala (3.1.0) | ||||
|     koala (3.2.0) | ||||
|       addressable | ||||
|       faraday (< 2) | ||||
|       json (>= 1.8) | ||||
|       rexml | ||||
|     launchy (2.5.0) | ||||
|       addressable (~> 2.7) | ||||
|     letter_opener (1.7.0) | ||||
|       launchy (~> 2.2) | ||||
|     line-bot-api (1.23.0) | ||||
|     liquid (5.1.0) | ||||
|     letter_opener (1.8.1) | ||||
|       launchy (>= 2.2, < 3) | ||||
|     libddprof (0.6.0.1.0) | ||||
|     libddprof (0.6.0.1.0-x86_64-linux) | ||||
|     libddwaf (1.3.0.2.0) | ||||
|       ffi (~> 1.0) | ||||
|     libddwaf (1.3.0.2.0-arm64-darwin) | ||||
|       ffi (~> 1.0) | ||||
|     libddwaf (1.3.0.2.0-x86_64-darwin) | ||||
|       ffi (~> 1.0) | ||||
|     libddwaf (1.3.0.2.0-x86_64-linux) | ||||
|       ffi (~> 1.0) | ||||
|     line-bot-api (1.25.0) | ||||
|     liquid (5.3.0) | ||||
|     listen (3.7.1) | ||||
|       rb-fsevent (~> 0.10, >= 0.10.3) | ||||
|       rb-inotify (~> 0.9, >= 0.9.10) | ||||
| @@ -358,36 +398,36 @@ GEM | ||||
|     mini_magick (4.11.0) | ||||
|     mini_mime (1.1.2) | ||||
|     mini_portile2 (2.8.0) | ||||
|     minitest (5.15.0) | ||||
|     mock_redis (0.30.0) | ||||
|     minitest (5.16.2) | ||||
|     mock_redis (0.32.0) | ||||
|       ruby2_keywords | ||||
|     momentjs-rails (2.29.1.1) | ||||
|       railties (>= 3.1) | ||||
|     msgpack (1.4.5) | ||||
|     msgpack (1.5.3) | ||||
|     multi_json (1.15.0) | ||||
|     multi_xml (0.6.0) | ||||
|     multipart-post (2.1.1) | ||||
|     multipart-post (2.2.3) | ||||
|     net-http-persistent (4.0.1) | ||||
|       connection_pool (~> 2.2) | ||||
|     netrc (0.11.0) | ||||
|     newrelic_rpm (8.7.0) | ||||
|     newrelic_rpm (8.9.0) | ||||
|     nio4r (2.5.8) | ||||
|     nokogiri (1.13.6) | ||||
|     nokogiri (1.13.7) | ||||
|       mini_portile2 (~> 2.8.0) | ||||
|       racc (~> 1.4) | ||||
|     nokogiri (1.13.6-arm64-darwin) | ||||
|     nokogiri (1.13.7-arm64-darwin) | ||||
|       racc (~> 1.4) | ||||
|     nokogiri (1.13.6-x86_64-darwin) | ||||
|     nokogiri (1.13.7-x86_64-darwin) | ||||
|       racc (~> 1.4) | ||||
|     nokogiri (1.13.6-x86_64-linux) | ||||
|     nokogiri (1.13.7-x86_64-linux) | ||||
|       racc (~> 1.4) | ||||
|     oauth (0.5.8) | ||||
|     oauth (0.5.10) | ||||
|     orm_adapter (0.5.0) | ||||
|     os (1.1.4) | ||||
|     parallel (1.21.0) | ||||
|     parser (3.1.1.0) | ||||
|     parallel (1.22.1) | ||||
|     parser (3.1.2.0) | ||||
|       ast (~> 2.4.1) | ||||
|     pg (1.3.2) | ||||
|     pg (1.4.1) | ||||
|     pg_search (2.3.6) | ||||
|       activerecord (>= 5.2) | ||||
|       activesupport (>= 5.2) | ||||
| @@ -398,46 +438,46 @@ GEM | ||||
|       method_source (~> 1.0) | ||||
|     pry-rails (0.3.9) | ||||
|       pry (>= 0.10.4) | ||||
|     public_suffix (4.0.6) | ||||
|     public_suffix (4.0.7) | ||||
|     puma (5.6.4) | ||||
|       nio4r (~> 2.0) | ||||
|     pundit (2.2.0) | ||||
|       activesupport (>= 3.0.0) | ||||
|     raabro (1.4.0) | ||||
|     racc (1.6.0) | ||||
|     rack (2.2.3.1) | ||||
|     rack-attack (6.6.0) | ||||
|     rack (2.2.4) | ||||
|     rack-attack (6.6.1) | ||||
|       rack (>= 1.0, < 3) | ||||
|     rack-cors (1.1.1) | ||||
|       rack (>= 2.0.0) | ||||
|     rack-proxy (0.7.2) | ||||
|       rack | ||||
|     rack-test (1.1.0) | ||||
|       rack (>= 1.0, < 3) | ||||
|     rack-timeout (0.6.0) | ||||
|     rails (6.1.5.1) | ||||
|       actioncable (= 6.1.5.1) | ||||
|       actionmailbox (= 6.1.5.1) | ||||
|       actionmailer (= 6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       actiontext (= 6.1.5.1) | ||||
|       actionview (= 6.1.5.1) | ||||
|       activejob (= 6.1.5.1) | ||||
|       activemodel (= 6.1.5.1) | ||||
|       activerecord (= 6.1.5.1) | ||||
|       activestorage (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     rack-test (2.0.2) | ||||
|       rack (>= 1.3) | ||||
|     rack-timeout (0.6.3) | ||||
|     rails (6.1.6.1) | ||||
|       actioncable (= 6.1.6.1) | ||||
|       actionmailbox (= 6.1.6.1) | ||||
|       actionmailer (= 6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       actiontext (= 6.1.6.1) | ||||
|       actionview (= 6.1.6.1) | ||||
|       activejob (= 6.1.6.1) | ||||
|       activemodel (= 6.1.6.1) | ||||
|       activerecord (= 6.1.6.1) | ||||
|       activestorage (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       bundler (>= 1.15.0) | ||||
|       railties (= 6.1.5.1) | ||||
|       railties (= 6.1.6.1) | ||||
|       sprockets-rails (>= 2.0.0) | ||||
|     rails-dom-testing (2.0.3) | ||||
|       activesupport (>= 4.2.0) | ||||
|       nokogiri (>= 1.6) | ||||
|     rails-html-sanitizer (1.4.3) | ||||
|       loofah (~> 2.3) | ||||
|     railties (6.1.5.1) | ||||
|       actionpack (= 6.1.5.1) | ||||
|       activesupport (= 6.1.5.1) | ||||
|     railties (6.1.6.1) | ||||
|       actionpack (= 6.1.6.1) | ||||
|       activesupport (= 6.1.6.1) | ||||
|       method_source | ||||
|       rake (>= 12.2) | ||||
|       thor (~> 1.0) | ||||
| @@ -446,11 +486,11 @@ GEM | ||||
|     rb-fsevent (0.11.1) | ||||
|     rb-inotify (0.10.1) | ||||
|       ffi (~> 1.0) | ||||
|     redis (4.6.0) | ||||
|     redis-namespace (1.8.1) | ||||
|     redis (4.7.1) | ||||
|     redis-namespace (1.8.2) | ||||
|       redis (>= 3.0.4) | ||||
|     regexp_parser (2.2.1) | ||||
|     representable (3.1.1) | ||||
|     regexp_parser (2.5.0) | ||||
|     representable (3.2.0) | ||||
|       declarative (< 0.1.0) | ||||
|       trailblazer-option (>= 0.1.1, < 0.2.0) | ||||
|       uber (< 0.2.0) | ||||
| @@ -469,7 +509,7 @@ GEM | ||||
|     rspec-expectations (3.11.0) | ||||
|       diff-lcs (>= 1.2.0, < 2.0) | ||||
|       rspec-support (~> 3.11.0) | ||||
|     rspec-mocks (3.11.0) | ||||
|     rspec-mocks (3.11.1) | ||||
|       diff-lcs (>= 1.2.0, < 2.0) | ||||
|       rspec-support (~> 3.11.0) | ||||
|     rspec-rails (5.0.3) | ||||
| @@ -481,26 +521,27 @@ GEM | ||||
|       rspec-mocks (~> 3.10) | ||||
|       rspec-support (~> 3.10) | ||||
|     rspec-support (3.11.0) | ||||
|     rubocop (1.25.1) | ||||
|     rubocop (1.31.2) | ||||
|       json (~> 2.3) | ||||
|       parallel (~> 1.10) | ||||
|       parser (>= 3.1.0.0) | ||||
|       rainbow (>= 2.2.2, < 4.0) | ||||
|       regexp_parser (>= 1.8, < 3.0) | ||||
|       rexml | ||||
|       rubocop-ast (>= 1.15.1, < 2.0) | ||||
|       rexml (>= 3.2.5, < 4.0) | ||||
|       rubocop-ast (>= 1.18.0, < 2.0) | ||||
|       ruby-progressbar (~> 1.7) | ||||
|       unicode-display_width (>= 1.4.0, < 3.0) | ||||
|     rubocop-ast (1.16.0) | ||||
|     rubocop-ast (1.19.1) | ||||
|       parser (>= 3.1.1.0) | ||||
|     rubocop-performance (1.13.2) | ||||
|     rubocop-performance (1.14.2) | ||||
|       rubocop (>= 1.7.0, < 2.0) | ||||
|       rubocop-ast (>= 0.4.0) | ||||
|     rubocop-rails (2.13.2) | ||||
|     rubocop-rails (2.15.2) | ||||
|       activesupport (>= 4.2.0) | ||||
|       rack (>= 1.1) | ||||
|       rubocop (>= 1.7.0, < 2.0) | ||||
|     rubocop-rspec (2.8.0) | ||||
|       rubocop (~> 1.19) | ||||
|     rubocop-rspec (2.12.1) | ||||
|       rubocop (~> 1.31) | ||||
|     ruby-progressbar (1.11.0) | ||||
|     ruby-vips (2.1.4) | ||||
|       ffi (~> 1.12) | ||||
| @@ -508,7 +549,7 @@ GEM | ||||
|     ruby2ruby (2.4.4) | ||||
|       ruby_parser (~> 3.1) | ||||
|       sexp_processor (~> 4.6) | ||||
|     ruby_parser (3.18.1) | ||||
|     ruby_parser (3.19.1) | ||||
|       sexp_processor (~> 4.16) | ||||
|     sassc (2.4.0) | ||||
|       ffi (~> 1.9) | ||||
| @@ -518,37 +559,37 @@ GEM | ||||
|       sprockets (> 3.0) | ||||
|       sprockets-rails | ||||
|       tilt | ||||
|     scout_apm (5.1.1) | ||||
|     scout_apm (5.2.0) | ||||
|       parser | ||||
|     seed_dump (3.3.1) | ||||
|       activerecord (>= 4) | ||||
|       activesupport (>= 4) | ||||
|     selectize-rails (0.12.6) | ||||
|     semantic_range (3.0.0) | ||||
|     sentry-rails (5.3.0) | ||||
|     sentry-rails (5.3.1) | ||||
|       railties (>= 5.0) | ||||
|       sentry-ruby-core (~> 5.3.0) | ||||
|     sentry-ruby (5.3.0) | ||||
|       sentry-ruby-core (~> 5.3.1) | ||||
|     sentry-ruby (5.3.1) | ||||
|       concurrent-ruby (~> 1.0, >= 1.0.2) | ||||
|       sentry-ruby-core (= 5.3.0) | ||||
|     sentry-ruby-core (5.3.0) | ||||
|       sentry-ruby-core (= 5.3.1) | ||||
|     sentry-ruby-core (5.3.1) | ||||
|       concurrent-ruby | ||||
|     sentry-sidekiq (5.3.0) | ||||
|       sentry-ruby-core (~> 5.3.0) | ||||
|     sentry-sidekiq (5.3.1) | ||||
|       sentry-ruby-core (~> 5.3.1) | ||||
|       sidekiq (>= 3.0) | ||||
|     sexp_processor (4.16.0) | ||||
|     sexp_processor (4.16.1) | ||||
|     shoulda-matchers (5.1.0) | ||||
|       activesupport (>= 5.2.0) | ||||
|     sidekiq (6.4.1) | ||||
|     sidekiq (6.4.2) | ||||
|       connection_pool (>= 2.2.2) | ||||
|       rack (~> 2.0) | ||||
|       redis (>= 4.2.0) | ||||
|     sidekiq-cron (1.4.0) | ||||
|     sidekiq-cron (1.6.0) | ||||
|       fugit (~> 1) | ||||
|       sidekiq (>= 4.2.1) | ||||
|     signet (0.16.0) | ||||
|     signet (0.17.0) | ||||
|       addressable (~> 2.8) | ||||
|       faraday (>= 0.17.3, < 2.0) | ||||
|       faraday (>= 0.17.5, < 3.a) | ||||
|       jwt (>= 1.5, < 3.0) | ||||
|       multi_json (~> 1.10) | ||||
|     simplecov (0.17.1) | ||||
| @@ -566,7 +607,7 @@ GEM | ||||
|     spring-watcher-listen (2.0.1) | ||||
|       listen (>= 2.7, < 4.0) | ||||
|       spring (>= 1.2, < 3.0) | ||||
|     sprockets (4.0.3) | ||||
|     sprockets (4.1.1) | ||||
|       concurrent-ruby (~> 1.0) | ||||
|       rack (> 1, < 3) | ||||
|     sprockets-rails (3.4.2) | ||||
| @@ -575,31 +616,31 @@ GEM | ||||
|       sprockets (>= 3.0.0) | ||||
|     squasher (0.6.2) | ||||
|     statsd-ruby (1.5.0) | ||||
|     telephone_number (1.4.13) | ||||
|     telephone_number (1.4.16) | ||||
|     thor (1.2.1) | ||||
|     tilt (2.0.10) | ||||
|     time_diff (0.3.0) | ||||
|       activesupport | ||||
|       i18n | ||||
|     trailblazer-option (0.1.2) | ||||
|     twilio-ruby (5.66.0) | ||||
|       faraday (>= 0.9, < 2.0) | ||||
|     twilio-ruby (5.68.0) | ||||
|       faraday (>= 0.9, < 3.0) | ||||
|       jwt (>= 1.5, <= 2.5) | ||||
|       nokogiri (>= 1.6, < 2.0) | ||||
|     twitty (0.1.4) | ||||
|       oauth | ||||
|     tzinfo (2.0.4) | ||||
|       concurrent-ruby (~> 1.0) | ||||
|     tzinfo-data (1.2021.5) | ||||
|     tzinfo-data (1.2022.1) | ||||
|       tzinfo (>= 1.0.0) | ||||
|     uber (0.1.0) | ||||
|     uglifier (4.2.0) | ||||
|       execjs (>= 0.3.0, < 3) | ||||
|     unf (0.1.4) | ||||
|       unf_ext | ||||
|     unf_ext (0.0.8) | ||||
|     unicode-display_width (2.1.0) | ||||
|     uniform_notifier (1.14.2) | ||||
|     unf_ext (0.0.8.2) | ||||
|     unicode-display_width (2.2.0) | ||||
|     uniform_notifier (1.16.0) | ||||
|     uri_template (0.7.0) | ||||
|     valid_email2 (4.0.3) | ||||
|       activemodel (>= 3.2) | ||||
| @@ -631,7 +672,7 @@ GEM | ||||
|     working_hours (1.4.1) | ||||
|       activesupport (>= 3.2) | ||||
|       tzinfo | ||||
|     zeitwerk (2.5.4) | ||||
|     zeitwerk (2.6.0) | ||||
|  | ||||
| PLATFORMS | ||||
|   arm64-darwin-20 | ||||
| @@ -705,7 +746,7 @@ DEPENDENCIES | ||||
|   rack-attack | ||||
|   rack-cors | ||||
|   rack-timeout | ||||
|   rails | ||||
|   rails (~> 6.1) | ||||
|   redis | ||||
|   redis-namespace | ||||
|   responders | ||||
|   | ||||
| @@ -9,12 +9,15 @@ class Campaigns::CampaignConversationBuilder | ||||
|       @contact_inbox.lock! | ||||
|  | ||||
|       # We won't send campaigns if a conversation is already present | ||||
|       return if @contact_inbox.reload.conversations.present? | ||||
|       raise 'Conversation alread present' if @contact_inbox.reload.conversations.present? | ||||
|  | ||||
|       @conversation = ::Conversation.create!(conversation_params) | ||||
|       Messages::MessageBuilder.new(@campaign.sender, @conversation, message_params).perform | ||||
|     end | ||||
|     @conversation | ||||
|   rescue StandardError => e | ||||
|     Rails.logger.info(e.message) | ||||
|     nil | ||||
|   end | ||||
|  | ||||
|   private | ||||
|   | ||||
| @@ -14,7 +14,7 @@ class Platform::Api::V1::UsersController < PlatformController | ||||
|  | ||||
|   def login | ||||
|     encoded_email = ERB::Util.url_encode(@resource.email) | ||||
|     render json: { url: "#{ENV['FRONTEND_URL']}/app/login?email=#{encoded_email}&sso_auth_token=#{@resource.generate_sso_auth_token}" } | ||||
|     render json: { url: "#{ENV.fetch('FRONTEND_URL', nil)}/app/login?email=#{encoded_email}&sso_auth_token=#{@resource.generate_sso_auth_token}" } | ||||
|   end | ||||
|  | ||||
|   def show; end | ||||
|   | ||||
| @@ -47,7 +47,7 @@ class ContactIpLookupJob < ApplicationJob | ||||
|   def setup_vendor_db | ||||
|     base_url = 'https://download.maxmind.com/app/geoip_download' | ||||
|     source_file = Down.download( | ||||
|       "#{base_url}?edition_id=GeoLite2-City&suffix=tar.gz&license_key=#{ENV['IP_LOOKUP_API_KEY']}" | ||||
|       "#{base_url}?edition_id=GeoLite2-City&suffix=tar.gz&license_key=#{ENV.fetch('IP_LOOKUP_API_KEY', nil)}" | ||||
|     ) | ||||
|     tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(source_file)) | ||||
|     tar_extract.rewind | ||||
|   | ||||
| @@ -3,7 +3,7 @@ class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer | ||||
|     return unless smtp_config_set_or_development? | ||||
|  | ||||
|     subject = 'Your Slack integration has expired' | ||||
|     @action_url = "#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/integrations/slack" | ||||
|     @action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/integrations/slack" | ||||
|     send_mail_with_liquid(to: admin_emails, subject: subject) and return | ||||
|   end | ||||
|  | ||||
| @@ -11,7 +11,7 @@ class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer | ||||
|     return unless smtp_config_set_or_development? | ||||
|  | ||||
|     subject = 'Your Facebook page connection has expired' | ||||
|     @action_url = "#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}" | ||||
|     @action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}" | ||||
|     send_mail_with_liquid(to: admin_emails, subject: subject) and return | ||||
|   end | ||||
|  | ||||
| @@ -19,7 +19,7 @@ class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer | ||||
|     return unless smtp_config_set_or_development? | ||||
|  | ||||
|     subject = 'Your email inbox has been disconnected. Please update the credentials for SMTP/IMAP' | ||||
|     @action_url = "#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}" | ||||
|     @action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}" | ||||
|     send_mail_with_liquid(to: admin_emails, subject: subject) and return | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -112,7 +112,7 @@ class Account < ApplicationRecord | ||||
|   end | ||||
|  | ||||
|   def support_email | ||||
|     super || ENV['MAILER_SENDER_EMAIL'] || GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL'] | ||||
|     super || ENV.fetch('MAILER_SENDER_EMAIL') { GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL'] } | ||||
|   end | ||||
|  | ||||
|   def usage_limits | ||||
|   | ||||
| @@ -63,7 +63,7 @@ class Category < ApplicationRecord | ||||
|   validates :name, presence: true | ||||
|   validate :allowed_locales | ||||
|   validates :locale, uniqueness: { scope: %i[slug portal_id], | ||||
|                                    message: 'should be unique in the category and portal' } | ||||
|                                    message: I18n.t('errors.categories.locale.unique') } | ||||
|   accepts_nested_attributes_for :related_categories | ||||
|  | ||||
|   scope :search_by_locale, ->(locale) { where(locale: locale) if locale.present? } | ||||
|   | ||||
| @@ -72,7 +72,7 @@ class Channel::Telegram < ApplicationRecord | ||||
|     HTTParty.post("#{telegram_api_url}/deleteWebhook") | ||||
|     response = HTTParty.post("#{telegram_api_url}/setWebhook", | ||||
|                              body: { | ||||
|                                url: "#{ENV['FRONTEND_URL']}/webhooks/telegram/#{bot_token}" | ||||
|                                url: "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/telegram/#{bot_token}" | ||||
|                              }) | ||||
|     errors.add(:bot_token, 'error setting up the webook') unless response.success? | ||||
|   end | ||||
|   | ||||
| @@ -29,11 +29,11 @@ class Contact < ApplicationRecord | ||||
|  | ||||
|   validates :account_id, presence: true | ||||
|   validates :email, allow_blank: true, uniqueness: { scope: [:account_id], case_sensitive: false }, | ||||
|                     format: { with: Devise.email_regexp, message: 'Invalid email' } | ||||
|                     format: { with: Devise.email_regexp, message: I18n.t('errors.contacts.email.invalid') } | ||||
|   validates :identifier, allow_blank: true, uniqueness: { scope: [:account_id] } | ||||
|   validates :phone_number, | ||||
|             allow_blank: true, uniqueness: { scope: [:account_id] }, | ||||
|             format: { with: /\+[1-9]\d{1,14}\z/, message: 'Should be in e164 format' } | ||||
|             format: { with: /\+[1-9]\d{1,14}\z/, message: I18n.t('errors.contacts.phone_number.invalid') } | ||||
|   validates :name, length: { maximum: 255 } | ||||
|  | ||||
|   belongs_to :account | ||||
|   | ||||
| @@ -22,7 +22,7 @@ | ||||
| # | ||||
| class DataImport < ApplicationRecord | ||||
|   belongs_to :account | ||||
|   validates :data_type, inclusion: { in: ['contacts'], message: '%<value>s is an invalid data type' } | ||||
|   validates :data_type, inclusion: { in: ['contacts'], message: I18n.t('errors.data_import.data_type.invalid') } | ||||
|   enum status: { pending: 0, processing: 1, completed: 2, failed: 3 } | ||||
|  | ||||
|   has_one_attached :import_file | ||||
|   | ||||
| @@ -115,13 +115,13 @@ class Inbox < ApplicationRecord | ||||
|   def callback_webhook_url | ||||
|     case channel_type | ||||
|     when 'Channel::TwilioSms' | ||||
|       "#{ENV['FRONTEND_URL']}/twilio/callback" | ||||
|       "#{ENV.fetch('FRONTEND_URL', nil)}/twilio/callback" | ||||
|     when 'Channel::Sms' | ||||
|       "#{ENV['FRONTEND_URL']}/webhooks/sms/#{channel.phone_number.delete_prefix('+')}" | ||||
|       "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/sms/#{channel.phone_number.delete_prefix('+')}" | ||||
|     when 'Channel::Line' | ||||
|       "#{ENV['FRONTEND_URL']}/webhooks/line/#{channel.line_channel_id}" | ||||
|       "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/line/#{channel.line_channel_id}" | ||||
|     when 'Channel::Whatsapp' | ||||
|       "#{ENV['FRONTEND_URL']}/webhooks/whatsapp/#{channel.phone_number}" | ||||
|       "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/whatsapp/#{channel.phone_number}" | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -15,6 +15,10 @@ | ||||
| #  index_installation_configs_on_name_and_created_at  (name,created_at) UNIQUE | ||||
| # | ||||
| class InstallationConfig < ApplicationRecord | ||||
|   # https://stackoverflow.com/questions/72970170/upgrading-to-rails-6-1-6-1-causes-psychdisallowedclass-tried-to-load-unspecif | ||||
|   # https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 | ||||
|   # FIX ME : fixes breakage of installation config. we need to migrate. | ||||
|   # Fix configuration in application.rb | ||||
|   serialize :serialized_value, HashWithIndifferentAccess | ||||
|  | ||||
|   before_validation :set_lock | ||||
|   | ||||
| @@ -28,7 +28,7 @@ class Integrations::App | ||||
|   def action | ||||
|     case params[:id] | ||||
|     when 'slack' | ||||
|       "#{params[:action]}&client_id=#{ENV['SLACK_CLIENT_ID']}&redirect_uri=#{self.class.slack_integration_url}" | ||||
|       "#{params[:action]}&client_id=#{ENV.fetch('SLACK_CLIENT_ID', nil)}&redirect_uri=#{self.class.slack_integration_url}" | ||||
|     else | ||||
|       params[:action] | ||||
|     end | ||||
| @@ -57,7 +57,7 @@ class Integrations::App | ||||
|   end | ||||
|  | ||||
|   def self.slack_integration_url | ||||
|     "#{ENV['FRONTEND_URL']}/app/accounts/#{Current.account.id}/settings/integrations/slack" | ||||
|     "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/integrations/slack" | ||||
|   end | ||||
|  | ||||
|   class << self | ||||
|   | ||||
| @@ -21,7 +21,7 @@ class Label < ApplicationRecord | ||||
|   belongs_to :account | ||||
|  | ||||
|   validates :title, | ||||
|             presence: { message: 'must not be blank' }, | ||||
|             presence: { message: I18n.t('errors.validations.presence') }, | ||||
|             format: { with: UNICODE_CHARACTER_NUMBER_HYPHEN_UNDERSCORE }, | ||||
|             uniqueness: { scope: :account_id } | ||||
|  | ||||
|   | ||||
| @@ -136,7 +136,7 @@ class Message < ApplicationRecord | ||||
|     # move this to a presenter | ||||
|     return self[:content] if !input_csat? || inbox.web_widget? | ||||
|  | ||||
|     I18n.t('conversations.survey.response', link: "#{ENV['FRONTEND_URL']}/survey/responses/#{conversation.uuid}") | ||||
|     I18n.t('conversations.survey.response', link: "#{ENV.fetch('FRONTEND_URL', nil)}/survey/responses/#{conversation.uuid}") | ||||
|   end | ||||
|  | ||||
|   def email_notifiable_message? | ||||
|   | ||||
| @@ -26,7 +26,7 @@ class Team < ApplicationRecord | ||||
|   has_many :conversations, dependent: :nullify | ||||
|  | ||||
|   validates :name, | ||||
|             presence: { message: 'must not be blank' }, | ||||
|             presence: { message: I18n.t('errors.validations.presence') }, | ||||
|             uniqueness: { scope: :account_id } | ||||
|  | ||||
|   before_validation do | ||||
|   | ||||
| @@ -73,7 +73,7 @@ class Notification::PushNotificationService | ||||
|     return unless ENV['FCM_SERVER_KEY'] | ||||
|     return unless subscription.fcm? | ||||
|  | ||||
|     fcm = FCM.new(ENV['FCM_SERVER_KEY']) | ||||
|     fcm = FCM.new(ENV.fetch('FCM_SERVER_KEY', nil)) | ||||
|     response = fcm.send([subscription.subscription_attributes['push_token']], fcm_options) | ||||
|     remove_subscription_if_error(subscription, response) | ||||
|   end | ||||
|   | ||||
| @@ -31,7 +31,7 @@ class Whatsapp::Providers::Whatsapp360DialogService < Whatsapp::Providers::BaseS | ||||
|       "#{api_base_path}/configs/webhook", | ||||
|       headers: { 'D360-API-KEY': whatsapp_channel.provider_config['api_key'], 'Content-Type': 'application/json' }, | ||||
|       body: { | ||||
|         url: "#{ENV['FRONTEND_URL']}/webhooks/whatsapp/#{whatsapp_channel.phone_number}" | ||||
|         url: "#{ENV.fetch('FRONTEND_URL', nil)}/webhooks/whatsapp/#{whatsapp_channel.phone_number}" | ||||
|       }.to_json | ||||
|     ) | ||||
|     response.success? | ||||
|   | ||||
| @@ -28,6 +28,11 @@ module Chatwoot | ||||
|  | ||||
|     # Custom chatwoot configurations | ||||
|     config.x = config_for(:app).with_indifferent_access | ||||
|  | ||||
|     # https://stackoverflow.com/questions/72970170/upgrading-to-rails-6-1-6-1-causes-psychdisallowedclass-tried-to-load-unspecif | ||||
|     # https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 | ||||
|     # FIX ME : fixes breakage of installation config. we need to migrate. | ||||
|     config.active_record.yaml_column_permitted_classes = [HashWithIndifferentAccess] | ||||
|   end | ||||
|  | ||||
|   def self.config | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| if ENV['DD_TRACE_AGENT_URL'] | ||||
|   Datadog.configure do |c| | ||||
|     # This will activate auto-instrumentation for Rails | ||||
|     c.use :rails | ||||
|     # Instrumentation | ||||
|     c.tracing.instrument :rails | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -27,6 +27,6 @@ if ENV['IP_LOOKUP_SERVICE'].present? | ||||
|   if ENV['IP_LOOKUP_SERVICE'] == 'geoip2' | ||||
|     Geocoder.configure(ip_lookup: :geoip2, geoip2: { file: GeocoderConfiguration::LOOK_UP_DB }) | ||||
|   else | ||||
|     Geocoder.configure(ip_lookup: ENV['IP_LOOKUP_SERVICE'].to_sym, api_key: ENV['IP_LOOKUP_API_KEY']) | ||||
|     Geocoder.configure(ip_lookup: ENV['IP_LOOKUP_SERVICE'].to_sym, api_key: ENV.fetch('IP_LOOKUP_API_KEY', nil)) | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -18,8 +18,8 @@ Rails.application.configure do | ||||
|  | ||||
|   smtp_settings[:authentication] = ENV.fetch('SMTP_AUTHENTICATION', 'login').to_sym if ENV['SMTP_AUTHENTICATION'].present? | ||||
|   smtp_settings[:domain] = ENV['SMTP_DOMAIN'] if ENV['SMTP_DOMAIN'].present? | ||||
|   smtp_settings[:user_name] = ENV['SMTP_USERNAME'] | ||||
|   smtp_settings[:password] = ENV['SMTP_PASSWORD'] | ||||
|   smtp_settings[:user_name] = ENV.fetch('SMTP_USERNAME', nil) | ||||
|   smtp_settings[:password] = ENV.fetch('SMTP_PASSWORD', nil) | ||||
|   smtp_settings[:enable_starttls_auto] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_ENABLE_STARTTLS_AUTO', true)) | ||||
|   smtp_settings[:openssl_verify_mode] = ENV['SMTP_OPENSSL_VERIFY_MODE'] if ENV['SMTP_OPENSSL_VERIFY_MODE'].present? | ||||
|   smtp_settings[:ssl] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_SSL', true)) if ENV['SMTP_SSL'] | ||||
|   | ||||
| @@ -36,6 +36,8 @@ en: | ||||
|     reset_password_failure: Uh ho! We could not find any user with the specified email. | ||||
|  | ||||
|   errors: | ||||
|     validations: | ||||
|       presence: must not be blank | ||||
|     webhook: | ||||
|       invalid: Invalid events | ||||
|     signup: | ||||
| @@ -43,9 +45,19 @@ en: | ||||
|       invalid_email: You have entered an invalid email | ||||
|       email_already_exists: "You have already signed up for an account with %{email}" | ||||
|       failed: Signup failed | ||||
|     data_import: | ||||
|       data_type: | ||||
|         invalid: Invalid data type | ||||
|     contacts: | ||||
|       import: | ||||
|         failed: File is blank | ||||
|       email:  | ||||
|         invalid: Invalid email | ||||
|       phone_number: | ||||
|         invalid: should be in e164 format | ||||
|     categories: | ||||
|       locale: | ||||
|         unique: should be unique in the category and portal | ||||
|     inboxes: | ||||
|       imap: | ||||
|         socket_error: Please check the network connection, IMAP address and try again. | ||||
|   | ||||
| @@ -3,7 +3,7 @@ require 'uri' | ||||
|  | ||||
| # Let DATABASE_URL env take presedence over individual connection params. | ||||
| if !ENV['DATABASE_URL'].nil? && ENV['DATABASE_URL'] != '' | ||||
|   uri = URI(ENV['DATABASE_URL']) | ||||
|   uri = URI(ENV.fetch('DATABASE_URL', nil)) | ||||
|   puts "export POSTGRES_HOST=#{uri.host} POSTGRES_PORT=#{uri.port} POSTGRES_USERNAME=#{uri.user}" | ||||
| elsif ENV['POSTGRES_PORT'].nil? || ENV['POSTGRES_PORT'] == '' | ||||
|   puts 'export POSTGRES_PORT=5432' | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| class ChatwootHub | ||||
|   BASE_URL = ENV['CHATWOOT_HUB_URL'] || 'https://hub.2.chatwoot.com' | ||||
|   BASE_URL = ENV.fetch('CHATWOOT_HUB_URL', 'https://hub.2.chatwoot.com') | ||||
|   PING_URL = "#{BASE_URL}/ping".freeze | ||||
|   REGISTRATION_URL = "#{BASE_URL}/instances".freeze | ||||
|   PUSH_NOTIFICATION_URL = "#{BASE_URL}/send_push".freeze | ||||
|   | ||||
| @@ -1,11 +1,11 @@ | ||||
| class GlobalConfigService | ||||
|   def self.load(config_key, default_value) | ||||
|     config = ENV[config_key] || GlobalConfig.get(config_key)[config_key] | ||||
|     config = ENV.fetch(config_key) { GlobalConfig.get(config_key)[config_key] } | ||||
|     return config if config.present? | ||||
|  | ||||
|     # To support migrating existing instance relying on env variables | ||||
|     # TODO: deprecate this later down the line | ||||
|     config_value = ENV[config_key] || default_value | ||||
|     config_value = ENV.fetch(config_key) { default_value } | ||||
|  | ||||
|     return if config_value.blank? | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService | ||||
|   end | ||||
|  | ||||
|   def avatar_url(sender) | ||||
|     sender.try(:avatar_url) || "#{ENV['FRONTEND_URL']}/admin/avatar_square.png" | ||||
|     sender.try(:avatar_url) || "#{ENV.fetch('FRONTEND_URL', nil)}/admin/avatar_square.png" | ||||
|   end | ||||
|  | ||||
|   def send_message | ||||
|   | ||||
| @@ -20,7 +20,7 @@ db_namespace = namespace :db do | ||||
|       # handling case where database was created by the provider, with out running db:setup | ||||
|       unless ActiveRecord::Base.connection.table_exists? 'ar_internal_metadata' | ||||
|         db_namespace['load_config'].invoke if ActiveRecord::Base.schema_format == :ruby | ||||
|         ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA']) | ||||
|         ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV.fetch('SCHEMA', nil)) | ||||
|         db_namespace['seed'].invoke | ||||
|       end | ||||
|  | ||||
|   | ||||
| @@ -14,8 +14,8 @@ class VapidService | ||||
|     # keys don't exist in the database. so let's generate and save them | ||||
|     keys = Webpush.generate_key | ||||
|     # TODO: remove the logic on environment variables when we completely deprecate | ||||
|     public_key = ENV['VAPID_PUBLIC_KEY'] || keys.public_key | ||||
|     private_key = ENV['VAPID_PRIVATE_KEY'] || keys.private_key | ||||
|     public_key = ENV.fetch('VAPID_PUBLIC_KEY') { keys.public_key } | ||||
|     private_key = ENV.fetch('VAPID_PRIVATE_KEY') { keys.private_key } | ||||
|  | ||||
|     i = InstallationConfig.where(name: 'VAPID_KEYS').first_or_create(value: { public_key: public_key, private_key: private_key }) | ||||
|     i.value | ||||
|   | ||||
| @@ -62,7 +62,7 @@ describe ::ContactIdentifyAction do | ||||
|         result = described_class.new(contact: contact, params: params).perform | ||||
|         expect(result.id).not_to eq existing_email_contact.id | ||||
|         expect(result.identifier).to eq params[:identifier] | ||||
|         expect(result.email).to eq nil | ||||
|         expect(result.email).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -82,7 +82,7 @@ describe ::ContactIdentifyAction do | ||||
|         result = described_class.new(contact: contact, params: params).perform | ||||
|         expect(result.id).not_to eq existing_phone_number_contact.id | ||||
|         expect(result.identifier).to eq params[:identifier] | ||||
|         expect(result.email).to eq nil | ||||
|         expect(result.email).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'will not overide the phone contacts email when params contains different email' do | ||||
| @@ -91,7 +91,7 @@ describe ::ContactIdentifyAction do | ||||
|         result = described_class.new(contact: contact, params: params).perform | ||||
|         expect(result.id).not_to eq existing_phone_number_contact.id | ||||
|         expect(result.email).to eq params[:email] | ||||
|         expect(result.phone_number).to eq nil | ||||
|         expect(result.phone_number).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -130,7 +130,7 @@ describe ::ContactIdentifyAction do | ||||
|         params = { phone_number: 'blahblah blah', name: 'new name' } | ||||
|         described_class.new(contact: contact, params: params, discard_invalid_attrs: true).perform | ||||
|         expect(contact.reload.name).to eq 'new name' | ||||
|         expect(contact.phone_number).to eq nil | ||||
|         expect(contact.phone_number).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -43,7 +43,7 @@ describe ::ContactMergeAction do | ||||
|       it 'does not delete contact' do | ||||
|         mergee_contact = base_contact | ||||
|         contact_merge | ||||
|         expect(mergee_contact.reload).not_to eq nil | ||||
|         expect(mergee_contact.reload).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -26,7 +26,7 @@ describe ::Campaigns::CampaignConversationBuilder do | ||||
|         campaign_display_id: campaign.display_id | ||||
|       ).perform | ||||
|  | ||||
|       expect(campaign_conversation).to eq(nil) | ||||
|       expect(campaign_conversation).to be_nil | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -226,7 +226,7 @@ describe ::ContactInboxBuilder do | ||||
|           inbox_id: api_inbox.id | ||||
|         ).perform | ||||
|  | ||||
|         expect(contact_inbox.source_id).not_to be(nil) | ||||
|         expect(contact_inbox.source_id).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -241,7 +241,7 @@ describe ::ContactInboxBuilder do | ||||
|           source_id: 'test' | ||||
|         ).perform | ||||
|  | ||||
|         expect(contact_inbox).to be(nil) | ||||
|         expect(contact_inbox).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -260,7 +260,7 @@ describe ::ContactInboxBuilder do | ||||
|           source_id: 'test' | ||||
|         ).perform | ||||
|  | ||||
|         expect(contact_inbox).to be(nil) | ||||
|         expect(contact_inbox).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -275,7 +275,7 @@ describe ::ContactInboxBuilder do | ||||
|           source_id: 'test' | ||||
|         ).perform | ||||
|  | ||||
|         expect(contact_inbox).to be(nil) | ||||
|         expect(contact_inbox).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -14,7 +14,7 @@ describe ::CsatSurveys::ResponseBuilder do | ||||
|         message: message | ||||
|       ).perform | ||||
|  | ||||
|       expect(csat_survey_response.valid?).to eq(true) | ||||
|       expect(csat_survey_response.valid?).to be(true) | ||||
|     end | ||||
|  | ||||
|     it 'updates the value of csat survey response if response already exists' do | ||||
|   | ||||
| @@ -69,7 +69,7 @@ RSpec.describe 'Agent Bot API', type: :request do | ||||
|  | ||||
|     context 'when it is an unauthenticated user' do | ||||
|       it 'returns unauthorized' do | ||||
|         expect { post "/api/v1/accounts/#{account.id}/agent_bots", params: valid_params }.to change(Label, :count).by(0) | ||||
|         expect { post "/api/v1/accounts/#{account.id}/agent_bots", params: valid_params }.not_to change(Label, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
| @@ -89,7 +89,7 @@ RSpec.describe 'Agent Bot API', type: :request do | ||||
|         expect do | ||||
|           post "/api/v1/accounts/#{account.id}/agent_bots", headers: agent.create_new_auth_token, | ||||
|                                                             params: valid_params | ||||
|         end.to change(AgentBot, :count).by(0) | ||||
|         end.not_to change(AgentBot, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
|   | ||||
| @@ -114,7 +114,7 @@ RSpec.describe 'Agents API', type: :request do | ||||
|         response_data = JSON.parse(response.body) | ||||
|         expect(response_data['role']).to eq('administrator') | ||||
|         expect(response_data['availability_status']).to eq('busy') | ||||
|         expect(response_data['auto_offline']).to eq(false) | ||||
|         expect(response_data['auto_offline']).to be(false) | ||||
|         expect(other_agent.account_users.first.role).to eq('administrator') | ||||
|       end | ||||
|     end | ||||
|   | ||||
| @@ -137,7 +137,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do | ||||
|                headers: agent.create_new_auth_token | ||||
|         expect(response).to have_http_status(:success) | ||||
|         deleted_article = Article.find_by(id: article.id) | ||||
|         expect(deleted_article).to be nil | ||||
|         expect(deleted_article).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| @@ -153,7 +153,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do | ||||
|     context 'when it is an authenticated user' do | ||||
|       it 'get all articles' do | ||||
|         article2 = create(:article, account_id: account.id, portal: portal, category: category, author_id: agent.id) | ||||
|         expect(article2.id).not_to be nil | ||||
|         expect(article2.id).not_to be_nil | ||||
|  | ||||
|         get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles", | ||||
|             headers: agent.create_new_auth_token, | ||||
| @@ -165,7 +165,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do | ||||
|  | ||||
|       it 'get all articles with searched params' do | ||||
|         article2 = create(:article, account_id: account.id, portal: portal, category: category, author_id: agent.id) | ||||
|         expect(article2.id).not_to be nil | ||||
|         expect(article2.id).not_to be_nil | ||||
|  | ||||
|         get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles", | ||||
|             headers: agent.create_new_auth_token, | ||||
| @@ -182,7 +182,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do | ||||
|                           category: category, | ||||
|                           author_id: agent.id, | ||||
|                           content: 'this is some test and funny content') | ||||
|         expect(article2.id).not_to be nil | ||||
|         expect(article2.id).not_to be_nil | ||||
|  | ||||
|         get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles", | ||||
|             headers: agent.create_new_auth_token, | ||||
| @@ -196,7 +196,7 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do | ||||
|     describe 'GET /api/v1/accounts/{account.id}/portals/{portal.slug}/articles/{article.id}' do | ||||
|       it 'get article' do | ||||
|         article2 = create(:article, account_id: account.id, portal: portal, category: category, author_id: agent.id) | ||||
|         expect(article2.id).not_to be nil | ||||
|         expect(article2.id).not_to be_nil | ||||
|  | ||||
|         get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/articles/#{article2.id}", | ||||
|             headers: agent.create_new_auth_token | ||||
|   | ||||
| @@ -307,7 +307,7 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do | ||||
|       end | ||||
|  | ||||
|       it 'returns for updated active flag for automation_rule' do | ||||
|         expect(automation_rule.active).to eq(true) | ||||
|         expect(automation_rule.active).to be(true) | ||||
|         params = { active: false } | ||||
|  | ||||
|         patch "/api/v1/accounts/#{account.id}/automation_rules/#{automation_rule.id}", | ||||
| @@ -316,8 +316,8 @@ RSpec.describe 'Api::V1::Accounts::AutomationRulesController', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         body = JSON.parse(response.body, symbolize_names: true) | ||||
|         expect(body[:payload][:active]).to eq(false) | ||||
|         expect(automation_rule.reload.active).to eq(false) | ||||
|         expect(body[:payload][:active]).to be(false) | ||||
|         expect(automation_rule.reload.active).to be(false) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -40,7 +40,7 @@ RSpec.describe 'Api::V1::Accounts::BulkActionsController', type: :request do | ||||
|       it 'Bulk update conversation status' do | ||||
|         expect(Conversation.first.status).to eq('open') | ||||
|         expect(Conversation.last.status).to eq('open') | ||||
|         expect(Conversation.first.assignee_id).to eq(nil) | ||||
|         expect(Conversation.first.assignee_id).to be_nil | ||||
|  | ||||
|         perform_enqueued_jobs do | ||||
|           post "/api/v1/accounts/#{account.id}/bulk_actions", | ||||
| @@ -52,15 +52,15 @@ RSpec.describe 'Api::V1::Accounts::BulkActionsController', type: :request do | ||||
|  | ||||
|         expect(Conversation.first.status).to eq('snoozed') | ||||
|         expect(Conversation.last.status).to eq('open') | ||||
|         expect(Conversation.first.assignee_id).to eq(nil) | ||||
|         expect(Conversation.first.assignee_id).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'Bulk update conversation assignee id' do | ||||
|         params = { type: 'Conversation', fields: { assignee_id: agent_1.id }, ids: Conversation.first(3).pluck(:display_id) } | ||||
|  | ||||
|         expect(Conversation.first.status).to eq('open') | ||||
|         expect(Conversation.first.assignee_id).to eq(nil) | ||||
|         expect(Conversation.second.assignee_id).to eq(nil) | ||||
|         expect(Conversation.first.assignee_id).to be_nil | ||||
|         expect(Conversation.second.assignee_id).to be_nil | ||||
|  | ||||
|         perform_enqueued_jobs do | ||||
|           post "/api/v1/accounts/#{account.id}/bulk_actions", | ||||
| @@ -79,7 +79,7 @@ RSpec.describe 'Api::V1::Accounts::BulkActionsController', type: :request do | ||||
|         params = { type: 'Conversation', fields: { assignee_id: agent_1.id, status: 'snoozed' }, ids: Conversation.first(3).pluck(:display_id) } | ||||
|  | ||||
|         expect(Conversation.first.status).to eq('open') | ||||
|         expect(Conversation.second.assignee_id).to eq(nil) | ||||
|         expect(Conversation.second.assignee_id).to be_nil | ||||
|  | ||||
|         perform_enqueued_jobs do | ||||
|           post "/api/v1/accounts/#{account.id}/bulk_actions", | ||||
|   | ||||
| @@ -145,7 +145,7 @@ RSpec.describe 'Campaigns API', type: :request do | ||||
|         expect(response).to have_http_status(:success) | ||||
|         response_data = JSON.parse(response.body, symbolize_names: true) | ||||
|         expect(response_data[:campaign_type]).to eq('one_off') | ||||
|         expect(response_data[:scheduled_at].present?).to eq true | ||||
|         expect(response_data[:scheduled_at].present?).to be true | ||||
|         expect(response_data[:scheduled_at]).to eq(scheduled_at.to_i) | ||||
|         expect(response_data[:audience].pluck(:id)).to include(label1.id, label2.id) | ||||
|       end | ||||
| @@ -222,7 +222,7 @@ RSpec.describe 'Campaigns API', type: :request do | ||||
|                as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(::Campaign.exists?(campaign.display_id)).to eq false | ||||
|         expect(::Campaign.exists?(campaign.display_id)).to be false | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -228,7 +228,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do | ||||
|                headers: agent.create_new_auth_token | ||||
|         expect(response).to have_http_status(:success) | ||||
|         deleted_category = Category.find_by(id: category.id) | ||||
|         expect(deleted_category).to be nil | ||||
|         expect(deleted_category).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| @@ -247,7 +247,7 @@ RSpec.describe 'Api::V1::Accounts::Categories', type: :request do | ||||
|  | ||||
|         category2 = create(:category, name: 'test_category_2', portal: portal, locale: 'es', slug: 'category_slug_2') | ||||
|  | ||||
|         expect(category2.id).not_to be nil | ||||
|         expect(category2.id).not_to be_nil | ||||
|  | ||||
|         get "/api/v1/accounts/#{account.id}/portals/#{portal.slug}/categories", | ||||
|             headers: agent.create_new_auth_token | ||||
|   | ||||
| @@ -5,7 +5,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/channels/twilio_channel', type: :r | ||||
|   let(:admin) { create(:user, account: account, role: :administrator) } | ||||
|   let(:agent) { create(:user, account: account, role: :agent) } | ||||
|   let(:twilio_client) { instance_double(::Twilio::REST::Client) } | ||||
|   let(:message_double) { instance_double('message') } | ||||
|   let(:message_double) { double } | ||||
|   let(:twilio_webhook_setup_service) { instance_double(::Twilio::WebhookSetupService) } | ||||
|  | ||||
|   before do | ||||
|   | ||||
| @@ -36,7 +36,7 @@ RSpec.describe '/api/v1/accounts/{account.id}/contacts/:id/contact_inboxes', typ | ||||
|                params: { inbox_id: channel_twilio_sms.inbox.id }, | ||||
|                headers: agent.create_new_auth_token, | ||||
|                as: :json | ||||
|         end.to change(ContactInbox, :count).by(0) | ||||
|         end.not_to change(ContactInbox, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unprocessable_entity) | ||||
|       end | ||||
|   | ||||
| @@ -114,7 +114,7 @@ RSpec.describe 'Notes API', type: :request do | ||||
|                as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(::Note.exists?(note.id)).to eq false | ||||
|         expect(::Note.exists?(note.id)).to be false | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -49,7 +49,7 @@ RSpec.describe 'Contacts API', type: :request do | ||||
|         expect(response).to have_http_status(:success) | ||||
|         response_body = JSON.parse(response.body) | ||||
|         expect(response_body['payload'].first['email']).to eq(contact.email) | ||||
|         expect(response_body['payload'].first['contact_inboxes'].blank?).to eq(true) | ||||
|         expect(response_body['payload'].first['contact_inboxes'].blank?).to be(true) | ||||
|       end | ||||
|  | ||||
|       it 'returns all contacts with company name desc order' do | ||||
| @@ -149,7 +149,7 @@ RSpec.describe 'Contacts API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(account.data_imports.count).to eq(1) | ||||
|         expect(account.data_imports.first.import_file.attached?).to eq(true) | ||||
|         expect(account.data_imports.first.import_file.attached?).to be(true) | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -364,7 +364,7 @@ RSpec.describe 'Contacts API', type: :request do | ||||
|  | ||||
|     context 'when it is an unauthenticated user' do | ||||
|       it 'returns unauthorized' do | ||||
|         expect { post "/api/v1/accounts/#{account.id}/contacts", params: valid_params }.to change(Contact, :count).by(0) | ||||
|         expect { post "/api/v1/accounts/#{account.id}/contacts", params: valid_params }.not_to change(Contact, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
| @@ -477,7 +477,7 @@ RSpec.describe 'Contacts API', type: :request do | ||||
|  | ||||
|       it 'updates avatar' do | ||||
|         # no avatar before upload | ||||
|         expect(contact.avatar.attached?).to eq(false) | ||||
|         expect(contact.avatar.attached?).to be(false) | ||||
|         file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png') | ||||
|         patch "/api/v1/accounts/#{account.id}/contacts/#{contact.id}", | ||||
|               params: valid_params.merge(avatar: file), | ||||
| @@ -485,7 +485,7 @@ RSpec.describe 'Contacts API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         contact.reload | ||||
|         expect(contact.avatar.attached?).to eq(true) | ||||
|         expect(contact.avatar.attached?).to be(true) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -68,7 +68,7 @@ RSpec.describe 'Conversation Assignment API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.assignee).to eq(nil) | ||||
|         expect(conversation.reload.assignee).to be_nil | ||||
|         expect(Conversations::ActivityMessageJob) | ||||
|           .to(have_been_enqueued.at_least(:once) | ||||
|         .with(conversation, { account_id: conversation.account_id, inbox_id: conversation.inbox_id, message_type: :activity, | ||||
| @@ -93,7 +93,7 @@ RSpec.describe 'Conversation Assignment API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.team).to eq(nil) | ||||
|         expect(conversation.reload.team).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -77,7 +77,7 @@ RSpec.describe 'Conversation Messages API', type: :request do | ||||
|              headers: agent.create_new_auth_token | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.messages.last.attachments.first.file.present?).to eq(true) | ||||
|         expect(conversation.messages.last.attachments.first.file.present?).to be(true) | ||||
|         expect(conversation.messages.last.attachments.first.file_type).to eq('image') | ||||
|       end | ||||
|     end | ||||
| @@ -113,7 +113,7 @@ RSpec.describe 'Conversation Messages API', type: :request do | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.messages.count).to eq(1) | ||||
|         expect(conversation.messages.first.content_type).to eq(params[:content_type]) | ||||
|         expect(conversation.messages.first.content).to eq nil | ||||
|         expect(conversation.messages.first.content).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'creates a new outgoing cards message' do | ||||
| @@ -187,8 +187,8 @@ RSpec.describe 'Conversation Messages API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(message.reload.content).to eq 'This message was deleted' | ||||
|         expect(message.reload.deleted).to eq true | ||||
|         expect(message.reload.content_attributes['bcc_emails']).to eq nil | ||||
|         expect(message.reload.deleted).to be true | ||||
|         expect(message.reload.content_attributes['bcc_emails']).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -490,20 +490,20 @@ RSpec.describe 'Conversations API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.agent_last_seen_at).not_to eq nil | ||||
|         expect(conversation.reload.agent_last_seen_at).not_to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'updates assignee last seen' do | ||||
|         conversation.update!(assignee_id: agent.id) | ||||
|  | ||||
|         expect(conversation.reload.assignee_last_seen_at).to eq nil | ||||
|         expect(conversation.reload.assignee_last_seen_at).to be_nil | ||||
|  | ||||
|         post "/api/v1/accounts/#{account.id}/conversations/#{conversation.display_id}/update_last_seen", | ||||
|              headers: agent.create_new_auth_token, | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.assignee_last_seen_at).not_to eq nil | ||||
|         expect(conversation.reload.assignee_last_seen_at).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| @@ -532,8 +532,8 @@ RSpec.describe 'Conversations API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.resolved?).to eq(true) | ||||
|         expect(conversation.reload.muted?).to eq(true) | ||||
|         expect(conversation.reload.resolved?).to be(true) | ||||
|         expect(conversation.reload.muted?).to be(true) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| @@ -562,7 +562,7 @@ RSpec.describe 'Conversations API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.muted?).to eq(false) | ||||
|         expect(conversation.reload.muted?).to be(false) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| @@ -636,7 +636,7 @@ RSpec.describe 'Conversations API', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.custom_attributes).not_to eq nil | ||||
|         expect(conversation.reload.custom_attributes).not_to be_nil | ||||
|         expect(conversation.reload.custom_attributes.count).to eq 3 | ||||
|       end | ||||
|     end | ||||
|   | ||||
| @@ -72,7 +72,7 @@ RSpec.describe 'Custom Attribute Definitions API', type: :request do | ||||
|         expect do | ||||
|           post "/api/v1/accounts/#{account.id}/custom_attribute_definitions", | ||||
|                params: payload | ||||
|         end.to change(CustomAttributeDefinition, :count).by(0) | ||||
|         end.not_to change(CustomAttributeDefinition, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
|   | ||||
| @@ -58,7 +58,7 @@ RSpec.describe 'Custom Filters API', type: :request do | ||||
|  | ||||
|     context 'when it is an unauthenticated user' do | ||||
|       it 'returns unauthorized' do | ||||
|         expect { post "/api/v1/accounts/#{account.id}/custom_filters", params: payload }.to change(CustomFilter, :count).by(0) | ||||
|         expect { post "/api/v1/accounts/#{account.id}/custom_filters", params: payload }.not_to change(CustomFilter, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
|   | ||||
| @@ -60,7 +60,7 @@ RSpec.describe 'DashboardAppsController', type: :request do | ||||
|  | ||||
|     context 'when it is an unauthenticated user' do | ||||
|       it 'returns unauthorized' do | ||||
|         expect { post "/api/v1/accounts/#{account.id}/dashboard_apps", params: payload }.to change(CustomFilter, :count).by(0) | ||||
|         expect { post "/api/v1/accounts/#{account.id}/dashboard_apps", params: payload }.not_to change(CustomFilter, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
| @@ -86,7 +86,7 @@ RSpec.describe 'DashboardAppsController', type: :request do | ||||
|         expect do | ||||
|           post "/api/v1/accounts/#{account.id}/dashboard_apps", headers: user.create_new_auth_token, | ||||
|                                                                 params: invalid_url_payload | ||||
|         end.to change(DashboardApp, :count).by(0) | ||||
|         end.not_to change(DashboardApp, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unprocessable_entity) | ||||
|         json_response = JSON.parse(response.body) | ||||
| @@ -97,7 +97,7 @@ RSpec.describe 'DashboardAppsController', type: :request do | ||||
|         expect do | ||||
|           post "/api/v1/accounts/#{account.id}/dashboard_apps", headers: user.create_new_auth_token, | ||||
|                                                                 params: invalid_type_payload | ||||
|         end.to change(DashboardApp, :count).by(0) | ||||
|         end.not_to change(DashboardApp, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unprocessable_entity) | ||||
|       end | ||||
|   | ||||
| @@ -414,7 +414,7 @@ RSpec.describe 'Inboxes API', type: :request do | ||||
|               as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(api_channel.reload.tweets_enabled).to eq(false) | ||||
|         expect(api_channel.reload.tweets_enabled).to be(false) | ||||
|       end | ||||
|  | ||||
|       it 'updates email inbox when administrator' do | ||||
| @@ -458,7 +458,7 @@ RSpec.describe 'Inboxes API', type: :request do | ||||
|  | ||||
|       it 'updates avatar when administrator' do | ||||
|         # no avatar before upload | ||||
|         expect(inbox.avatar.attached?).to eq(false) | ||||
|         expect(inbox.avatar.attached?).to be(false) | ||||
|         file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png') | ||||
|         patch "/api/v1/accounts/#{account.id}/inboxes/#{inbox.id}", | ||||
|               params: valid_params.merge(avatar: file), | ||||
| @@ -466,7 +466,7 @@ RSpec.describe 'Inboxes API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         inbox.reload | ||||
|         expect(inbox.avatar.attached?).to eq(true) | ||||
|         expect(inbox.avatar.attached?).to be(true) | ||||
|       end | ||||
|  | ||||
|       it 'updates working hours when administrator' do | ||||
| @@ -613,7 +613,7 @@ RSpec.describe 'Inboxes API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         inbox_data = JSON.parse(response.body, symbolize_names: true) | ||||
|         expect(inbox_data[:agent_bot].blank?).to eq(true) | ||||
|         expect(inbox_data[:agent_bot].blank?).to be(true) | ||||
|       end | ||||
|  | ||||
|       it 'returns the agent bot attached to the inbox' do | ||||
|   | ||||
| @@ -104,7 +104,7 @@ RSpec.describe 'Integration Hooks API', type: :request do | ||||
|                as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(::Integrations::Hook.exists?(hook.id)).to eq false | ||||
|         expect(::Integrations::Hook.exists?(hook.id)).to be false | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -55,7 +55,7 @@ RSpec.describe 'Label API', type: :request do | ||||
|  | ||||
|     context 'when it is an unauthenticated user' do | ||||
|       it 'returns unauthorized' do | ||||
|         expect { post "/api/v1/accounts/#{account.id}/labels", params: valid_params }.to change(Label, :count).by(0) | ||||
|         expect { post "/api/v1/accounts/#{account.id}/labels", params: valid_params }.not_to change(Label, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:unauthorized) | ||||
|       end | ||||
|   | ||||
| @@ -70,7 +70,7 @@ RSpec.describe 'Notifications API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(notification1.reload.read_at).not_to eq('') | ||||
|         expect(notification2.reload.read_at).to eq nil | ||||
|         expect(notification2.reload.read_at).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -21,7 +21,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do | ||||
|     context 'when it is an authenticated user' do | ||||
|       it 'get all portals' do | ||||
|         portal2 = create(:portal, name: 'test_portal_2', account_id: account.id, slug: 'portal-2') | ||||
|         expect(portal2.id).not_to be nil | ||||
|         expect(portal2.id).not_to be_nil | ||||
|         get "/api/v1/accounts/#{account.id}/portals", | ||||
|             headers: agent.create_new_auth_token | ||||
|  | ||||
| @@ -155,7 +155,7 @@ RSpec.describe 'Api::V1::Accounts::Portals', type: :request do | ||||
|                headers: admin.create_new_auth_token | ||||
|         expect(response).to have_http_status(:success) | ||||
|         deleted_portal = Portal.find_by(id: portal.slug) | ||||
|         expect(deleted_portal).to be nil | ||||
|         expect(deleted_portal).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -206,14 +206,14 @@ RSpec.describe 'Accounts API', type: :request do | ||||
|  | ||||
|     context 'when it is an authenticated user' do | ||||
|       it 'modifies an account' do | ||||
|         expect(agent.account_users.first.active_at).to eq(nil) | ||||
|         expect(agent.account_users.first.active_at).to be_nil | ||||
|         post "/api/v1/accounts/#{account.id}/update_active_at", | ||||
|              params: {}, | ||||
|              headers: agent.create_new_auth_token, | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(agent.account_users.first.active_at).not_to eq(nil) | ||||
|         expect(agent.account_users.first.active_at).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -79,7 +79,7 @@ RSpec.describe 'Profile API', type: :request do | ||||
|             as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(agent.reload.valid_password?('Test1234!')).to eq true | ||||
|         expect(agent.reload.valid_password?('Test1234!')).to be true | ||||
|       end | ||||
|  | ||||
|       it 'throws error when current password provided is invalid' do | ||||
| @@ -105,7 +105,7 @@ RSpec.describe 'Profile API', type: :request do | ||||
|  | ||||
|       it 'updates avatar' do | ||||
|         # no avatar before upload | ||||
|         expect(agent.avatar.attached?).to eq(false) | ||||
|         expect(agent.avatar.attached?).to be(false) | ||||
|         file = fixture_file_upload(Rails.root.join('spec/assets/avatar.png'), 'image/png') | ||||
|         put '/api/v1/profile', | ||||
|             params: { profile: { avatar: file } }, | ||||
| @@ -113,7 +113,7 @@ RSpec.describe 'Profile API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         agent.reload | ||||
|         expect(agent.avatar.attached?).to eq(true) | ||||
|         expect(agent.avatar.attached?).to be(true) | ||||
|       end | ||||
|  | ||||
|       it 'updates the ui settings' do | ||||
| @@ -124,7 +124,7 @@ RSpec.describe 'Profile API', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         json_response = JSON.parse(response.body) | ||||
|         expect(json_response['ui_settings']['is_contact_sidebar_open']).to eq(false) | ||||
|         expect(json_response['ui_settings']['is_contact_sidebar_open']).to be(false) | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -40,7 +40,7 @@ RSpec.describe '/api/v1/widget/config', type: :request do | ||||
|                params: params, | ||||
|                headers: { 'X-Auth-Token' => token }, | ||||
|                as: :json | ||||
|         end.to change(Contact, :count).by(0) | ||||
|         end.not_to change(Contact, :count) | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         response_data = JSON.parse(response.body) | ||||
|   | ||||
| @@ -103,8 +103,8 @@ RSpec.describe '/api/v1/widget/contacts', type: :request do | ||||
|  | ||||
|         body = JSON.parse(response.body) | ||||
|         expect(body['id']).not_to eq(contact.id) | ||||
|         expect(body['widget_auth_token']).not_to eq(nil) | ||||
|         expect(Contact.find(body['id']).contact_inboxes.first.hmac_verified?).to eq(true) | ||||
|         expect(body['widget_auth_token']).not_to be_nil | ||||
|         expect(Contact.find(body['id']).contact_inboxes.first.hmac_verified?).to be(true) | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -66,7 +66,7 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do | ||||
|  | ||||
|       expect(response).to have_http_status(:success) | ||||
|       json_response = JSON.parse(response.body) | ||||
|       expect(json_response['id']).not_to eq nil | ||||
|       expect(json_response['id']).not_to be_nil | ||||
|       expect(json_response['contact']['email']).to eq 'contact-email@chatwoot.com' | ||||
|       expect(json_response['contact']['phone_number']).to eq '+919745313456' | ||||
|       expect(json_response['contact']['name']).to eq 'contact-name' | ||||
| @@ -95,7 +95,7 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do | ||||
|  | ||||
|       expect(response).to have_http_status(:success) | ||||
|       json_response = JSON.parse(response.body) | ||||
|       expect(json_response['id']).not_to eq nil | ||||
|       expect(json_response['id']).not_to be_nil | ||||
|       expect(json_response['contact']['email']).to eq existing_contact.email | ||||
|       expect(json_response['contact']['name']).not_to eq 'contact-name' | ||||
|       expect(json_response['contact']['phone_number']).to eq '+919745313456' | ||||
| @@ -124,7 +124,7 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do | ||||
|     context 'with a conversation' do | ||||
|       it 'returns the correct conversation params' do | ||||
|         allow(Rails.configuration.dispatcher).to receive(:dispatch) | ||||
|         expect(conversation.contact_last_seen_at).to eq(nil) | ||||
|         expect(conversation.contact_last_seen_at).to be_nil | ||||
|  | ||||
|         post '/api/v1/widget/conversations/update_last_seen', | ||||
|              headers: { 'X-Auth-Token' => token }, | ||||
| @@ -133,7 +133,7 @@ RSpec.describe '/api/v1/widget/conversations/toggle_typing', type: :request do | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|  | ||||
|         expect(conversation.reload.contact_last_seen_at).not_to eq(nil) | ||||
|         expect(conversation.reload.contact_last_seen_at).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -82,7 +82,7 @@ RSpec.describe '/api/v1/widget/messages', type: :request do | ||||
|         json_response = JSON.parse(response.body) | ||||
|         expect(json_response['content']).to eq(message_params[:content]) | ||||
|  | ||||
|         expect(conversation.messages.last.attachments.first.file.present?).to eq(true) | ||||
|         expect(conversation.messages.last.attachments.first.file.present?).to be(true) | ||||
|         expect(conversation.messages.last.attachments.first.file_type).to eq('image') | ||||
|       end | ||||
|  | ||||
| @@ -96,7 +96,7 @@ RSpec.describe '/api/v1/widget/messages', type: :request do | ||||
|              as: :json | ||||
|  | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.resolved?).to eq(true) | ||||
|         expect(conversation.reload.resolved?).to be(true) | ||||
|       end | ||||
|  | ||||
|       it 'does not create resolved activity messages when snoozed conversation is opened' do | ||||
| @@ -118,7 +118,7 @@ RSpec.describe '/api/v1/widget/messages', type: :request do | ||||
|           } | ||||
|         ) | ||||
|         expect(response).to have_http_status(:success) | ||||
|         expect(conversation.reload.open?).to eq(true) | ||||
|         expect(conversation.reload.open?).to be(true) | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -15,7 +15,7 @@ RSpec.describe 'Token Confirmation', type: :request do | ||||
|       let(:confirmation_token) { '12345' } | ||||
|  | ||||
|       it 'has status 200' do | ||||
|         expect(response.status).to eq 200 | ||||
|         expect(response).to have_http_status :ok | ||||
|       end | ||||
|  | ||||
|       it 'returns "auth data"' do | ||||
| @@ -28,7 +28,7 @@ RSpec.describe 'Token Confirmation', type: :request do | ||||
|       let(:confirmation_token) { '' } | ||||
|  | ||||
|       it 'has status 422' do | ||||
|         expect(response.status).to eq 422 | ||||
|         expect(response).to have_http_status :unprocessable_entity | ||||
|       end | ||||
|  | ||||
|       it 'returns message "Invalid token"' do | ||||
| @@ -41,7 +41,7 @@ RSpec.describe 'Token Confirmation', type: :request do | ||||
|       let(:confirmation_token) { '12345' } | ||||
|  | ||||
|       it 'has status 422' do | ||||
|         expect(response.status).to eq 422 | ||||
|         expect(response).to have_http_status :unprocessable_entity | ||||
|       end | ||||
|  | ||||
|       it 'returns message "Already confirmed"' do | ||||
|   | ||||
| @@ -6,7 +6,7 @@ RSpec.describe 'Installation::Onboarding API', type: :request do | ||||
|   describe 'GET /installation/onboarding' do | ||||
|     context 'when CHATWOOT_INSTALLATION_ONBOARDING redis key is not set' do | ||||
|       it 'redirects back' do | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to eq nil | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to be_nil | ||||
|         get '/installation/onboarding' | ||||
|         expect(response).to have_http_status(:redirect) | ||||
|       end | ||||
| @@ -23,7 +23,7 @@ RSpec.describe 'Installation::Onboarding API', type: :request do | ||||
|   end | ||||
|  | ||||
|   describe 'POST /installation/onboarding' do | ||||
|     let(:account_builder) { instance_double('account_builder') } | ||||
|     let(:account_builder) { double } | ||||
|  | ||||
|     before do | ||||
|       allow(AccountBuilder).to receive(:new).and_return(account_builder) | ||||
| @@ -39,7 +39,7 @@ RSpec.describe 'Installation::Onboarding API', type: :request do | ||||
|     context 'when onboarding successfull' do | ||||
|       it 'deletes the redis key' do | ||||
|         post '/installation/onboarding', params: { user: {} } | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to eq nil | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'will not call register instance when checkboxes are unchecked' do | ||||
| @@ -57,7 +57,7 @@ RSpec.describe 'Installation::Onboarding API', type: :request do | ||||
|       it 'does not deletes the redis key' do | ||||
|         allow(AccountBuilder).to receive(:new).and_raise('error') | ||||
|         post '/installation/onboarding', params: { user: {} } | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).not_to eq nil | ||||
|         expect(::Redis::Alfred.get(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).not_to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -12,8 +12,8 @@ RSpec.describe 'Public Inbox Contacts API', type: :request do | ||||
|       expect(response).to have_http_status(:success) | ||||
|       data = response.parsed_body | ||||
|       expect(data.keys).to include('email', 'id', 'name', 'phone_number', 'pubsub_token', 'source_id') | ||||
|       expect(data['source_id']).not_to eq nil | ||||
|       expect(data['pubsub_token']).not_to eq nil | ||||
|       expect(data['source_id']).not_to be_nil | ||||
|       expect(data['pubsub_token']).not_to be_nil | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ RSpec.describe 'Public Inbox Contact Conversations API', type: :request do | ||||
|  | ||||
|       expect(response).to have_http_status(:success) | ||||
|       data = JSON.parse(response.body) | ||||
|       expect(data['id']).not_to eq nil | ||||
|       expect(data['id']).not_to be_nil | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -49,7 +49,7 @@ RSpec.describe 'Public Inbox Contact Conversation Messages API', type: :request | ||||
|       data = JSON.parse(response.body) | ||||
|       expect(data['content']).to eq('hello') | ||||
|  | ||||
|       expect(conversation.messages.last.attachments.first.file.present?).to eq(true) | ||||
|       expect(conversation.messages.last.attachments.first.file.present?).to be(true) | ||||
|       expect(conversation.messages.last.attachments.first.file_type).to eq('image') | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -32,7 +32,7 @@ RSpec.describe 'Public Articles API', type: :request do | ||||
|                         category: category, | ||||
|                         author_id: agent.id, | ||||
|                         content: 'this is some test and funny content') | ||||
|       expect(article2.id).not_to be nil | ||||
|       expect(article2.id).not_to be_nil | ||||
|  | ||||
|       get "/public/api/v1/portals/#{portal.slug}/articles", | ||||
|           headers: agent.create_new_auth_token, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ describe '/survey/response', type: :request do | ||||
|  | ||||
|     it 'returns 404 when called with invalid conversation uuid' do | ||||
|       get survey_response_url(id: '') | ||||
|       expect(response.status).to eq(404) | ||||
|       expect(response).to have_http_status(:not_found) | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -36,7 +36,7 @@ RSpec.describe 'Super Admin Application Config API', type: :request do | ||||
|         sign_in(super_admin, scope: :super_admin) | ||||
|         post '/super_admin/app_config', params: { app_config: { TESTKEY: 'TESTVALUE' } } | ||||
|  | ||||
|         expect(response.status).to eq(302) | ||||
|         expect(response).to have_http_status(:found) | ||||
|         expect(response).to redirect_to(super_admin_app_config_path) | ||||
|  | ||||
|         config = GlobalConfig.get('TESTKEY') | ||||
|   | ||||
| @@ -3,9 +3,7 @@ require 'rails_helper' | ||||
| RSpec.describe 'Twitter::CallbacksController', type: :request do | ||||
|   let(:twitter_client) { instance_double(::Twitty::Facade) } | ||||
|   let(:twitter_response) { instance_double(::Twitty::Response, status: '200', body: { message: 'Valid' }) } | ||||
|   let(:raw_response) do | ||||
|     object_double('raw_response', body: 'oauth_token=1&oauth_token_secret=1&user_id=100&screen_name=chatwoot') | ||||
|   end | ||||
|   let(:raw_response) { double } | ||||
|   let(:account) { create(:account) } | ||||
|   let(:webhook_service) { double } | ||||
|  | ||||
| @@ -15,6 +13,7 @@ RSpec.describe 'Twitter::CallbacksController', type: :request do | ||||
|     allow(::Redis::Alfred).to receive(:delete).and_return('OK') | ||||
|     allow(twitter_client).to receive(:access_token).and_return(twitter_response) | ||||
|     allow(twitter_response).to receive(:raw_response).and_return(raw_response) | ||||
|     allow(raw_response).to receive(:body).and_return('oauth_token=1&oauth_token_secret=1&user_id=100&screen_name=chatwoot') | ||||
|     allow(::Twitter::WebhookSubscribeService).to receive(:new).and_return(webhook_service) | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,7 @@ describe '/widget', type: :request do | ||||
|  | ||||
|     it 'returns 404 when called with out website_token' do | ||||
|       get widget_url | ||||
|       expect(response.status).to eq(404) | ||||
|       expect(response).to have_http_status(:not_found) | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -4,11 +4,11 @@ describe UrlHelper, type: :helper do | ||||
|   describe '#url_valid' do | ||||
|     context 'when url valid called' do | ||||
|       it 'return if valid url passed' do | ||||
|         expect(helper.url_valid?('https://app.chatwoot.com/')).to eq true | ||||
|         expect(helper.url_valid?('https://app.chatwoot.com/')).to be true | ||||
|       end | ||||
|  | ||||
|       it 'return false if invalid url passed' do | ||||
|         expect(helper.url_valid?('javascript:alert(document.cookie)')).to eq false | ||||
|         expect(helper.url_valid?('javascript:alert(document.cookie)')).to be false | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -51,7 +51,7 @@ RSpec.describe BulkActionsJob, type: :job do | ||||
|         ids: Conversation.first(3).pluck(:display_id) | ||||
|       } | ||||
|  | ||||
|       expect(Conversation.first.assignee_id).to eq(nil) | ||||
|       expect(Conversation.first.assignee_id).to be_nil | ||||
|  | ||||
|       described_class.perform_now(account: account, params: params, user: agent) | ||||
|  | ||||
|   | ||||
| @@ -7,13 +7,6 @@ describe Webhooks::InstagramEventsJob do | ||||
|   before do | ||||
|     stub_request(:post, /graph.facebook.com/) | ||||
|     stub_request(:get, 'https://www.example.com/test.jpeg') | ||||
|       .with( | ||||
|         headers: { | ||||
|           'Accept' => '*/*', | ||||
|           'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', | ||||
|           'User-Agent' => 'Down/5.3.0' | ||||
|         } | ||||
|       ) | ||||
|       .to_return(status: 200, body: '', headers: {}) | ||||
|   end | ||||
|  | ||||
| @@ -78,7 +71,7 @@ describe Webhooks::InstagramEventsJob do | ||||
|         instagram_webhook.perform_now(unsend_event[:entry]) | ||||
|  | ||||
|         expect(instagram_inbox.messages.last.content).to eq 'This message was deleted' | ||||
|         expect(instagram_inbox.messages.last.reload.deleted).to eq true | ||||
|         expect(instagram_inbox.messages.last.reload.deleted).to be true | ||||
|       end | ||||
|  | ||||
|       it 'creates incoming message with attachments in the instagram inbox' do | ||||
|   | ||||
| @@ -2,7 +2,7 @@ require 'rails_helper' | ||||
|  | ||||
| describe ChatwootCaptcha do | ||||
|   it 'returns true if HCAPTCHA SERVER KEY is absent' do | ||||
|     expect(described_class.new('random_key').valid?).to eq(true) | ||||
|     expect(described_class.new('random_key').valid?).to be(true) | ||||
|   end | ||||
|  | ||||
|   context 'when HCAPTCHA SERVER KEY is present' do | ||||
| @@ -11,7 +11,7 @@ describe ChatwootCaptcha do | ||||
|     end | ||||
|  | ||||
|     it 'returns false if client response is blank' do | ||||
|       expect(described_class.new('').valid?).to eq false | ||||
|       expect(described_class.new('').valid?).to be false | ||||
|     end | ||||
|  | ||||
|     it 'returns true if client response is valid' do | ||||
| @@ -19,7 +19,7 @@ describe ChatwootCaptcha do | ||||
|       allow(HTTParty).to receive(:post).and_return(captcha_request) | ||||
|       allow(captcha_request).to receive(:success?).and_return(true) | ||||
|       allow(captcha_request).to receive(:parsed_response).and_return({ 'success' => true }) | ||||
|       expect(described_class.new('valid_response').valid?).to eq true | ||||
|       expect(described_class.new('valid_response').valid?).to be true | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -3,7 +3,7 @@ require 'rails_helper' | ||||
| describe ChatwootHub do | ||||
|   it 'generates installation identifier' do | ||||
|     installation_identifier = described_class.installation_identifier | ||||
|     expect(installation_identifier).not_to eq nil | ||||
|     expect(installation_identifier).not_to be_nil | ||||
|     expect(described_class.installation_identifier).to eq installation_identifier | ||||
|   end | ||||
|  | ||||
| @@ -28,7 +28,7 @@ describe ChatwootHub do | ||||
|  | ||||
|     it 'returns nil when chatwoot hub is down' do | ||||
|       allow(RestClient).to receive(:post).and_raise(ExceptionList::REST_CLIENT_EXCEPTIONS.sample) | ||||
|       expect(described_class.latest_version).to eq nil | ||||
|       expect(described_class.latest_version).to be_nil | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,7 @@ describe GlobalConfigService do | ||||
|  | ||||
|       it 'get value from env variable even if present on DB' do | ||||
|         with_modified_env ENABLE_ACCOUNT_SIGNUP: 'false' do | ||||
|           expect(InstallationConfig.find_by(name: 'ENABLE_ACCOUNT_SIGNUP')&.value).to eq nil | ||||
|           expect(InstallationConfig.find_by(name: 'ENABLE_ACCOUNT_SIGNUP')&.value).to be_nil | ||||
|           value = described_class.load('ENABLE_ACCOUNT_SIGNUP', 'true') | ||||
|           expect(value).to eq 'false' | ||||
|         end | ||||
|   | ||||
| @@ -61,7 +61,7 @@ describe Integrations::Csml::ProcessorService do | ||||
|       let(:conversation) { create(:conversation, account: account, status: :open) } | ||||
|  | ||||
|       it 'returns nil' do | ||||
|         expect(processor.perform).to be(nil) | ||||
|         expect(processor.perform).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -69,7 +69,7 @@ describe Integrations::Csml::ProcessorService do | ||||
|       let(:message) { create(:message, account: account, conversation: conversation, private: true) } | ||||
|  | ||||
|       it 'returns nil' do | ||||
|         expect(processor.perform).to be(nil) | ||||
|         expect(processor.perform).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -77,7 +77,7 @@ describe Integrations::Csml::ProcessorService do | ||||
|       let(:message) { create(:message, account: account, conversation: conversation, message_type: :template) } | ||||
|  | ||||
|       it 'returns nil' do | ||||
|         expect(processor.perform).to be(nil) | ||||
|         expect(processor.perform).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -100,7 +100,7 @@ describe Integrations::Csml::ProcessorService do | ||||
|         let(:event_name) { 'message.updated' } | ||||
|  | ||||
|         it 'returns nil' do | ||||
|           expect(processor.perform).to be(nil) | ||||
|           expect(processor.perform).to be_nil | ||||
|         end | ||||
|       end | ||||
|     end | ||||
|   | ||||
| @@ -93,7 +93,7 @@ describe Integrations::Dialogflow::ProcessorService do | ||||
|       let(:conversation) { create(:conversation, account: account, status: :open) } | ||||
|  | ||||
|       it 'returns nil' do | ||||
|         expect(processor.perform).to be(nil) | ||||
|         expect(processor.perform).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
| @@ -101,7 +101,7 @@ describe Integrations::Dialogflow::ProcessorService do | ||||
|       let(:message) { create(:message, account: account, conversation: conversation, private: true) } | ||||
|  | ||||
|       it 'returns nil' do | ||||
|         expect(processor.perform).to be(nil) | ||||
|         expect(processor.perform).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -36,7 +36,7 @@ describe Integrations::Slack::IncomingMessageBuilder do | ||||
|       end | ||||
|  | ||||
|       it 'creates message' do | ||||
|         expect(hook).not_to eq nil | ||||
|         expect(hook).not_to be_nil | ||||
|         messages_count = conversation.messages.count | ||||
|         builder = described_class.new(message_params) | ||||
|         allow(builder).to receive(:sender).and_return(nil) | ||||
| @@ -71,7 +71,7 @@ describe Integrations::Slack::IncomingMessageBuilder do | ||||
|       end | ||||
|  | ||||
|       it 'saves attachment if params files present' do | ||||
|         expect(hook).not_to eq nil | ||||
|         expect(hook).not_to be_nil | ||||
|         messages_count = conversation.messages.count | ||||
|         builder = described_class.new(message_with_attachments) | ||||
|         allow(builder).to receive(:sender).and_return(nil) | ||||
| @@ -82,7 +82,7 @@ describe Integrations::Slack::IncomingMessageBuilder do | ||||
|       end | ||||
|  | ||||
|       it 'ignore message if it is postback of CW attachment message' do | ||||
|         expect(hook).not_to eq nil | ||||
|         expect(hook).not_to be_nil | ||||
|         messages_count = conversation.messages.count | ||||
|         message_with_attachments[:event][:text] = 'Attached File!' | ||||
|         builder = described_class.new(message_with_attachments) | ||||
|   | ||||
| @@ -134,7 +134,7 @@ describe NotificationListener do | ||||
|  | ||||
|         event = Events::Base.new(event_name, Time.zone.now, message: message) | ||||
|         # want to validate message_created doesnt throw an error | ||||
|         expect(listener.message_created(event)).to eq nil | ||||
|         expect(listener.message_created(event)).to be_nil | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|   | ||||
| @@ -136,7 +136,7 @@ RSpec.describe ReplyMailbox, type: :mailbox do | ||||
|         described_subject | ||||
|         current_message = conversation.messages.last | ||||
|         expect(current_message.content).to eq( | ||||
|           <<-BODY.strip_heredoc.chomp | ||||
|           <<~BODY.chomp | ||||
|             Yes, I am providing you step how to reproduce this issue | ||||
|  | ||||
|             On Thu, Aug 19, 2021 at 2:07 PM Tejaswini from Email sender test < tejaswini@chatwoot.com> wrote: | ||||
| @@ -157,7 +157,7 @@ RSpec.describe ReplyMailbox, type: :mailbox do | ||||
|         described_subject | ||||
|         current_message = conversation.messages.last | ||||
|         expect(current_message.reload.content_attributes[:email][:text_content][:reply]).to eq( | ||||
|           <<-BODY.strip_heredoc.chomp | ||||
|           <<~BODY.chomp | ||||
|             Yes, I am providing you step how to reproduce this issue | ||||
|  | ||||
|             On Thu, Aug 19, 2021 at 2:07 PM Tejaswini from Email sender test < tejaswini@chatwoot.com> wrote: | ||||
|   | ||||
| @@ -12,7 +12,7 @@ RSpec.describe SupportMailbox, type: :mailbox do | ||||
|  | ||||
|     it 'shouldnt create a conversation in the channel' do | ||||
|       described_subject | ||||
|       expect(conversation.present?).to eq(false) | ||||
|       expect(conversation.present?).to be(false) | ||||
|     end | ||||
|   end | ||||
|  | ||||
| @@ -202,7 +202,7 @@ RSpec.describe SupportMailbox, type: :mailbox do | ||||
|         expect(conversation.inbox.id).to eq(channel_email.inbox.id) | ||||
|  | ||||
|         expect(conversation.messages.last.content_attributes['email']['html_content']['reply']).to include( | ||||
|           <<-BODY.strip_heredoc.chomp | ||||
|           <<~BODY.chomp | ||||
|             Hi, | ||||
|             We are providing you platform from here you can sell paid posts on your website. | ||||
|  | ||||
| @@ -231,7 +231,7 @@ RSpec.describe SupportMailbox, type: :mailbox do | ||||
|         expect(conversation.inbox.id).to eq(channel_email.inbox.id) | ||||
|  | ||||
|         expect(conversation.messages.last.content).to eq( | ||||
|           <<-BODY.strip_heredoc.chomp | ||||
|           <<~BODY.chomp | ||||
|             This is html only mail | ||||
|           BODY | ||||
|         ) | ||||
| @@ -243,7 +243,7 @@ RSpec.describe SupportMailbox, type: :mailbox do | ||||
|  | ||||
|         expect(conversation.inbox.id).to eq(channel_email.inbox.id) | ||||
|  | ||||
|         expect(conversation.messages.last.content).to eq(nil) | ||||
|         expect(conversation.messages.last.content).to be_nil | ||||
|         expect(conversation.messages.last.attachments.count).to eq(1) | ||||
|         expect(conversation.messages.last.content_attributes['email']['subject']).to eq('only attachments') | ||||
|       end | ||||
|   | ||||
| @@ -70,7 +70,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile | ||||
|  | ||||
|     it 'will not send email if agent is online' do | ||||
|       ::OnlineStatusTracker.update_presence(conversation.account.id, 'User', agent.id) | ||||
|       expect(mail).to eq nil | ||||
|       expect(mail).to be_nil | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -71,7 +71,7 @@ RSpec.describe ConversationReplyMailer, type: :mailer do | ||||
|       it 'will not send email if conversation is already viewed by contact' do | ||||
|         create(:message, message_type: 'outgoing', account: account, conversation: conversation) | ||||
|         conversation.update(contact_last_seen_at: Time.zone.now) | ||||
|         expect(mail).to eq nil | ||||
|         expect(mail).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'will send email to cc and bcc email addresses' do | ||||
| @@ -132,7 +132,7 @@ RSpec.describe ConversationReplyMailer, type: :mailer do | ||||
|       it 'will not send email if conversation is already viewed by contact' do | ||||
|         create(:message, message_type: 'outgoing', account: account, conversation: conversation) | ||||
|         conversation.update(contact_last_seen_at: Time.zone.now) | ||||
|         expect(mail).to eq nil | ||||
|         expect(mail).to be_nil | ||||
|       end | ||||
|     end | ||||
|  | ||||
|   | ||||
| @@ -13,10 +13,10 @@ RSpec.describe User do | ||||
|  | ||||
|   describe 'notification_settings' do | ||||
|     it 'gets created with the right default settings' do | ||||
|       expect(account_user.user.notification_settings).not_to eq(nil) | ||||
|       expect(account_user.user.notification_settings).not_to be_nil | ||||
|  | ||||
|       expect(account_user.user.notification_settings.first.email_conversation_creation?).to eq(false) | ||||
|       expect(account_user.user.notification_settings.first.email_conversation_assignment?).to eq(true) | ||||
|       expect(account_user.user.notification_settings.first.email_conversation_creation?).to be(false) | ||||
|       expect(account_user.user.notification_settings.first.email_conversation_assignment?).to be(true) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,7 @@ RSpec.describe Attachment, type: :model do | ||||
|       message = create(:message) | ||||
|       attachment = message.attachments.new(account_id: message.account_id, file_type: :image) | ||||
|       attachment.file.attach(io: File.open(Rails.root.join('spec/assets/avatar.png')), filename: 'avatar.png', content_type: 'image/png') | ||||
|       expect(attachment.download_url).not_to eq nil | ||||
|       expect(attachment.download_url).not_to be_nil | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -50,7 +50,7 @@ RSpec.describe AutomationRule, type: :model do | ||||
|  | ||||
|     it 'returns valid record' do | ||||
|       rule = FactoryBot.build(:automation_rule, params) | ||||
|       expect(rule.valid?).to eq true | ||||
|       expect(rule.valid?).to be true | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -34,7 +34,7 @@ RSpec.describe Campaign, type: :model do | ||||
|     let(:campaign) { build(:campaign, inbox: facebook_inbox) } | ||||
|  | ||||
|     it 'would not save the campaigns' do | ||||
|       expect(campaign.save).to eq false | ||||
|       expect(campaign.save).to be false | ||||
|       expect(campaign.errors.full_messages.first).to eq 'Inbox Unsupported Inbox type' | ||||
|     end | ||||
|   end | ||||
| @@ -46,18 +46,18 @@ RSpec.describe Campaign, type: :model do | ||||
|  | ||||
|     it 'would prevent further updates' do | ||||
|       campaign.title = 'new name' | ||||
|       expect(campaign.save).to eq false | ||||
|       expect(campaign.save).to be false | ||||
|       expect(campaign.errors.full_messages.first).to eq 'Status The campaign is already completed' | ||||
|     end | ||||
|  | ||||
|     it 'can be deleted' do | ||||
|       campaign.destroy! | ||||
|       expect(described_class.exists?(campaign.id)).to eq false | ||||
|       expect(described_class.exists?(campaign.id)).to be false | ||||
|     end | ||||
|  | ||||
|     it 'cant be triggered' do | ||||
|       expect(Twilio::OneoffSmsCampaignService).not_to receive(:new).with(campaign: campaign) | ||||
|       expect(campaign.trigger!).to eq nil | ||||
|       expect(campaign.trigger!).to be_nil | ||||
|     end | ||||
|   end | ||||
|  | ||||
| @@ -71,7 +71,7 @@ RSpec.describe Campaign, type: :model do | ||||
|         campaign.campaign_type = 'ongoing' | ||||
|         campaign.save! | ||||
|         expect(campaign.reload.campaign_type).to eq 'one_off' | ||||
|         expect(campaign.scheduled_at.present?).to eq true | ||||
|         expect(campaign.scheduled_at.present?).to be true | ||||
|       end | ||||
|  | ||||
|       it 'calls twilio service on trigger!' do | ||||
| @@ -92,7 +92,7 @@ RSpec.describe Campaign, type: :model do | ||||
|         campaign.campaign_type = 'ongoing' | ||||
|         campaign.save! | ||||
|         expect(campaign.reload.campaign_type).to eq 'one_off' | ||||
|         expect(campaign.scheduled_at.present?).to eq true | ||||
|         expect(campaign.scheduled_at.present?).to be true | ||||
|       end | ||||
|  | ||||
|       it 'calls sms service on trigger!' do | ||||
|   | ||||
| @@ -8,7 +8,7 @@ RSpec.describe Channel::TwilioSms do | ||||
|       let!(:whatsapp_channel) { create(:channel_twilio_sms, medium: :whatsapp) } | ||||
|  | ||||
|       it 'returns true' do | ||||
|         expect(whatsapp_channel.messaging_window_enabled?).to eq true | ||||
|         expect(whatsapp_channel.messaging_window_enabled?).to be true | ||||
|         expect(whatsapp_channel.name).to eq 'Whatsapp' | ||||
|         expect(whatsapp_channel.medium).to eq 'whatsapp' | ||||
|       end | ||||
| @@ -18,7 +18,7 @@ RSpec.describe Channel::TwilioSms do | ||||
|       let!(:sms_channel) { create(:channel_twilio_sms, medium: :sms) } | ||||
|  | ||||
|       it 'returns false' do | ||||
|         expect(sms_channel.messaging_window_enabled?).to eq false | ||||
|         expect(sms_channel.messaging_window_enabled?).to be false | ||||
|         expect(sms_channel.name).to eq 'Twilio SMS' | ||||
|         expect(sms_channel.medium).to eq 'sms' | ||||
|       end | ||||
|   | ||||
| @@ -8,7 +8,7 @@ RSpec.describe Channel::Whatsapp do | ||||
|  | ||||
|     it 'validates false when provider config is wrong' do | ||||
|       stub_request(:get, 'https://graph.facebook.com/v14.0//message_templates?access_token=test_key').to_return(status: 401) | ||||
|       expect(channel.save).to eq(false) | ||||
|       expect(channel.save).to be(false) | ||||
|     end | ||||
|  | ||||
|     it 'validates true when provider config is right' do | ||||
| @@ -17,7 +17,7 @@ RSpec.describe Channel::Whatsapp do | ||||
|                    body: { data: [{ | ||||
|                      id: '123456789', name: 'test_template' | ||||
|                    }] }.to_json) | ||||
|       expect(channel.save).to eq(true) | ||||
|       expect(channel.save).to be(true) | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -4,6 +4,6 @@ shared_examples_for 'access_tokenable' do | ||||
|   let(:obj) { create(described_class.to_s.underscore) } | ||||
|  | ||||
|   it 'creates access token on create' do | ||||
|     expect(obj.access_token).not_to eq(nil) | ||||
|     expect(obj.access_token).not_to be_nil | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -21,8 +21,8 @@ shared_examples_for 'assignment_handler' do | ||||
|       end | ||||
|  | ||||
|       it 'creates team assigned and unassigned message activity' do | ||||
|         expect(conversation.update(team: team)).to eq true | ||||
|         expect(conversation.update(team: nil)).to eq true | ||||
|         expect(conversation.update(team: team)).to be true | ||||
|         expect(conversation.update(team: nil)).to be true | ||||
|         expect(Conversations::ActivityMessageJob).to(have_been_enqueued.at_least(:once) | ||||
|           .with(conversation, { account_id: conversation.account_id, inbox_id: conversation.inbox_id, message_type: :activity, | ||||
|                                 content: "Assigned to #{team.name} by #{agent.name}"  })) | ||||
| @@ -32,11 +32,11 @@ shared_examples_for 'assignment_handler' do | ||||
|       end | ||||
|  | ||||
|       it 'changes assignee to nil if they doesnt belong to the team and allow_auto_assign is false' do | ||||
|         expect(team.allow_auto_assign).to eq false | ||||
|         expect(team.allow_auto_assign).to be false | ||||
|  | ||||
|         conversation.update(team: team) | ||||
|  | ||||
|         expect(conversation.reload.assignee).to eq nil | ||||
|         expect(conversation.reload.assignee).to be_nil | ||||
|       end | ||||
|  | ||||
|       it 'changes assignee to a team member if allow_auto_assign is enabled' do | ||||
| @@ -74,7 +74,7 @@ shared_examples_for 'assignment_handler' do | ||||
|     let(:assignment_mailer) { instance_double(AgentNotifications::ConversationNotificationsMailer, deliver: true) } | ||||
|  | ||||
|     it 'assigns the agent to conversation' do | ||||
|       expect(update_assignee).to eq(true) | ||||
|       expect(update_assignee).to be(true) | ||||
|       expect(conversation.reload.assignee).to eq(agent) | ||||
|     end | ||||
|  | ||||
| @@ -82,7 +82,7 @@ shared_examples_for 'assignment_handler' do | ||||
|       # TODO: FIX me | ||||
|       # expect(EventDispatcherJob).to(have_been_enqueued.at_least(:once).with('assignee.changed', anything, anything, anything, anything)) | ||||
|       expect(EventDispatcherJob).to(have_been_enqueued.at_least(:once)) | ||||
|       expect(update_assignee).to eq(true) | ||||
|       expect(update_assignee).to be(true) | ||||
|     end | ||||
|  | ||||
|     context 'when agent is current user' do | ||||
| @@ -91,7 +91,7 @@ shared_examples_for 'assignment_handler' do | ||||
|       end | ||||
|  | ||||
|       it 'creates self-assigned message activity' do | ||||
|         expect(update_assignee).to eq(true) | ||||
|         expect(update_assignee).to be(true) | ||||
|         expect(Conversations::ActivityMessageJob).to(have_been_enqueued.at_least(:once) | ||||
|           .with(conversation, { account_id: conversation.account_id, inbox_id: conversation.inbox_id, | ||||
|                                 message_type: :activity, content: "#{agent.name} self-assigned this conversation" })) | ||||
|   | ||||
| @@ -14,21 +14,21 @@ shared_examples_for 'reauthorizable' do | ||||
|  | ||||
|   it 'prompts reauthorization when error threshold is passed' do | ||||
|     obj = FactoryBot.create(model.to_s.underscore.tr('/', '_').to_sym) | ||||
|     expect(obj.reauthorization_required?).to eq false | ||||
|     expect(obj.reauthorization_required?).to be false | ||||
|  | ||||
|     obj.class::AUTHORIZATION_ERROR_THRESHOLD.times do | ||||
|       obj.authorization_error! | ||||
|     end | ||||
|  | ||||
|     expect(obj.reauthorization_required?).to eq true | ||||
|     expect(obj.reauthorization_required?).to be true | ||||
|   end | ||||
|  | ||||
|   it 'prompt_reauthorization!' do | ||||
|     obj = FactoryBot.create(model.to_s.underscore.tr('/', '_').to_sym) | ||||
|     expect(obj.reauthorization_required?).to eq false | ||||
|     expect(obj.reauthorization_required?).to be false | ||||
|  | ||||
|     obj.prompt_reauthorization! | ||||
|     expect(obj.reauthorization_required?).to eq true | ||||
|     expect(obj.reauthorization_required?).to be true | ||||
|   end | ||||
|  | ||||
|   it 'reauthorized!' do | ||||
| @@ -36,13 +36,13 @@ shared_examples_for 'reauthorizable' do | ||||
|     # setting up the object with the errors to validate its cleared on action | ||||
|     obj.authorization_error! | ||||
|     obj.prompt_reauthorization! | ||||
|     expect(obj.reauthorization_required?).to eq true | ||||
|     expect(obj.reauthorization_required?).to be true | ||||
|     expect(obj.authorization_error_count).not_to eq 0 | ||||
|  | ||||
|     obj.reauthorized! | ||||
|  | ||||
|     # authorization errors are reset | ||||
|     expect(obj.authorization_error_count).to eq 0 | ||||
|     expect(obj.reauthorization_required?).to eq false | ||||
|     expect(obj.reauthorization_required?).to be false | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -31,7 +31,7 @@ shared_examples_for 'round_robin_handler' do | ||||
|       inbox.update(enable_auto_assignment: false) | ||||
|  | ||||
|       # run_round_robin | ||||
|       expect(conversation.reload.assignee).to eq(nil) | ||||
|       expect(conversation.reload.assignee).to be_nil | ||||
|     end | ||||
|  | ||||
|     it 'will not auto assign agent if its a bot conversation' do | ||||
| @@ -45,7 +45,7 @@ shared_examples_for 'round_robin_handler' do | ||||
|       ) | ||||
|  | ||||
|       # run_round_robin | ||||
|       expect(conversation.reload.assignee).to eq(nil) | ||||
|       expect(conversation.reload.assignee).to be_nil | ||||
|     end | ||||
|  | ||||
|     it 'gets triggered on update only when status changes to open' do | ||||
|   | ||||
| @@ -8,7 +8,7 @@ RSpec.describe ContactInbox do | ||||
|  | ||||
|     it 'gets created on object create' do | ||||
|       obj = contact_inbox | ||||
|       expect(obj.pubsub_token).not_to eq(nil) | ||||
|       expect(obj.pubsub_token).not_to be_nil | ||||
|     end | ||||
|  | ||||
|     it 'does not get updated on object update' do | ||||
| @@ -29,7 +29,7 @@ RSpec.describe ContactInbox do | ||||
|  | ||||
|       # ensure the column is nil in database | ||||
|       results = ActiveRecord::Base.connection.execute('Select * from contact_inboxes;') | ||||
|       expect(results.first['pubsub_token']).to eq(nil) | ||||
|       expect(results.first['pubsub_token']).to be_nil | ||||
|  | ||||
|       new_token = obj.pubsub_token | ||||
|       obj.update(source_id: '234234323') | ||||
|   | ||||
| @@ -52,7 +52,7 @@ RSpec.describe Contact do | ||||
|  | ||||
|     it 'updates phone number when adding valid phone number' do | ||||
|       contact = create(:contact) | ||||
|       expect(contact.update!(phone_number: '+12312312321')).to eq true | ||||
|       expect(contact.update!(phone_number: '+12312312321')).to be true | ||||
|       expect(contact.phone_number).to eq '+12312312321' | ||||
|     end | ||||
|   end | ||||
| @@ -65,7 +65,7 @@ RSpec.describe Contact do | ||||
|  | ||||
|     it 'updates email when adding valid email' do | ||||
|       contact = create(:contact) | ||||
|       expect(contact.update!(email: 'test@test.com')).to eq true | ||||
|       expect(contact.update!(email: 'test@test.com')).to be true | ||||
|       expect(contact.email).to eq 'test@test.com' | ||||
|     end | ||||
|   end | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 Sojan Jose
					Sojan Jose