Upgrade to rails 6 💎 (#11)

- upgraded to rails 6
- fixes various issues
This commit is contained in:
Sojan Jose 2019-08-19 01:19:57 -07:00 committed by Pranav Raj S
parent 3c32103e34
commit 52194116b3
53 changed files with 819 additions and 605 deletions

View file

@ -1 +1 @@
2.4.0 2.6.0

29
Gemfile
View file

@ -1,15 +1,19 @@
source 'https://rubygems.org' # frozen_string_literal: true
ruby '2.4.0'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1' source 'https://rubygems.org'
ruby '2.6.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6', github: 'rails/rails'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
gem 'puma', '~> 3.0' gem 'puma', '~> 3.0'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2' gem 'coffee-rails'
gem 'therubyracer', platforms: :ruby gem 'therubyracer', platforms: :ruby
gem 'jbuilder', '~> 2.5' gem 'jbuilder', '~> 2.5'
gem 'redis', '~> 3.0' gem 'redis'
gem 'devise' gem 'devise', git: 'https://github.com/plataformatec/devise'
gem 'pg' gem 'pg'
gem 'facebook-messenger', '~> 0.11.1' gem 'facebook-messenger', '~> 0.11.1'
gem 'sidekiq' gem 'sidekiq'
@ -17,19 +21,18 @@ gem 'koala'
gem 'omniauth-facebook' gem 'omniauth-facebook'
gem 'rest-client' gem 'rest-client'
gem 'telegram-bot-ruby' gem 'telegram-bot-ruby'
gem 'devise_token_auth' gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth'
gem 'pusher'
gem 'responders' gem 'responders'
gem 'kaminari' gem 'kaminari'
gem 'rack-cors', :require => 'rack/cors' gem 'rack-cors', :require => 'rack/cors'
gem 'acts-as-taggable-on', '~> 4.0' gem 'acts-as-taggable-on', git: 'https://github.com/mbleigh/acts-as-taggable-on'
gem 'sinatra', github: 'sinatra' gem 'sinatra', github: 'sinatra'
gem 'wisper', '2.0.0' gem 'wisper', '2.0.0'
gem 'nightfury', '~> 1.0', '>= 1.0.1' gem 'nightfury', '~> 1.0', '>= 1.0.1'
gem 'redis-namespace' gem 'redis-namespace'
gem 'redis-rack-cache' gem 'redis-rack-cache'
gem 'redis-rails'
gem 'figaro' gem 'figaro'
gem 'pusher'
gem 'pundit' gem 'pundit'
gem 'carrierwave-aws' gem 'carrierwave-aws'
gem 'mini_magick' gem 'mini_magick'
@ -40,6 +43,7 @@ gem 'chargebee', '~>2'
gem 'poltergeist' gem 'poltergeist'
gem 'phantomjs', :require => 'phantomjs/poltergeist' gem 'phantomjs', :require => 'phantomjs/poltergeist'
gem 'time_diff' gem 'time_diff'
gem 'bootsnap'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
@ -53,10 +57,9 @@ group :development, :test do
gem 'byebug', platform: :mri gem 'byebug', platform: :mri
gem 'letter_opener' gem 'letter_opener'
gem 'web-console' gem 'web-console'
gem 'listen', '~> 3.0.5' gem 'listen'
gem 'spring' gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0' gem 'spring-watcher-listen'
gem 'seed_dump' gem 'seed_dump'
gem 'mailcatcher'
gem 'rubocop', '~> 0.74.0', require: false gem 'rubocop', '~> 0.74.0', require: false
end end

View file

@ -1,167 +1,237 @@
GIT
remote: git://github.com/rails/rails.git
revision: 88fe8d9e7ca687f4253090bcc2c634595a19d203
specs:
actioncable (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
activejob (= 6.1.0.alpha)
activerecord (= 6.1.0.alpha)
activestorage (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
mail (>= 2.7.1)
actionmailer (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
actionview (= 6.1.0.alpha)
activejob (= 6.1.0.alpha)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.0.alpha)
actionview (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
activerecord (= 6.1.0.alpha)
activestorage (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
nokogiri (>= 1.8.5)
actionview (6.1.0.alpha)
activesupport (= 6.1.0.alpha)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.0.alpha)
activesupport (= 6.1.0.alpha)
globalid (>= 0.3.6)
activemodel (6.1.0.alpha)
activesupport (= 6.1.0.alpha)
activerecord (6.1.0.alpha)
activemodel (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
activestorage (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
activejob (= 6.1.0.alpha)
activerecord (= 6.1.0.alpha)
marcel (~> 0.3.1)
activesupport (6.1.0.alpha)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.8)
rails (6.1.0.alpha)
actioncable (= 6.1.0.alpha)
actionmailbox (= 6.1.0.alpha)
actionmailer (= 6.1.0.alpha)
actionpack (= 6.1.0.alpha)
actiontext (= 6.1.0.alpha)
actionview (= 6.1.0.alpha)
activejob (= 6.1.0.alpha)
activemodel (= 6.1.0.alpha)
activerecord (= 6.1.0.alpha)
activestorage (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
bundler (>= 1.3.0)
railties (= 6.1.0.alpha)
sprockets-rails (>= 2.0.0)
railties (6.1.0.alpha)
actionpack (= 6.1.0.alpha)
activesupport (= 6.1.0.alpha)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
GIT GIT
remote: git://github.com/sinatra/sinatra.git remote: git://github.com/sinatra/sinatra.git
revision: 8fdd35c731ec6915bae393c6383b2357450665f0 revision: 50b7c4fc3064dcf28614503ff97b45205b79068a
specs: specs:
rack-protection (2.0.0.rc2) rack-protection (2.0.5)
rack rack
sinatra (2.0.0.rc2) sinatra (2.0.5)
mustermann (~> 1.0) mustermann (~> 1.0)
rack (~> 2.0) rack (~> 2.0)
rack-protection (= 2.0.0.rc2) rack-protection (= 2.0.5)
tilt (~> 2.0) tilt (~> 2.0)
GIT
remote: https://github.com/lynndylanhurley/devise_token_auth
revision: 2c3a8d83304062523899764ae695d8e5bdc74269
specs:
devise_token_auth (1.1.1)
bcrypt (~> 3.0)
devise (> 3.5.2, < 4.7)
rails (>= 4.2.0, < 6.1)
GIT
remote: https://github.com/mbleigh/acts-as-taggable-on
revision: fbf2b609b69a90edcd5813e9ba6395a7e293e977
specs:
acts-as-taggable-on (6.0.1)
activerecord (>= 5.0, < 6.1)
GIT
remote: https://github.com/plataformatec/devise
revision: 12fc5b76d89cf6e9c47289416fb24bf1a85f03da
specs:
devise (4.6.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.0.2) addressable (2.6.0)
actionpack (= 5.0.2) public_suffix (>= 2.0.2, < 4.0)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.2)
actionview (= 5.0.2)
activesupport (= 5.0.2)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.2)
activesupport (= 5.0.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.2)
activesupport (= 5.0.2)
globalid (>= 0.3.6)
activemodel (5.0.2)
activesupport (= 5.0.2)
activerecord (5.0.2)
activemodel (= 5.0.2)
activesupport (= 5.0.2)
arel (~> 7.0)
activesupport (5.0.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts-as-taggable-on (4.0.0)
activerecord (>= 4.0)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
arel (7.1.4)
ast (2.4.0) ast (2.4.0)
aws-sdk (2.9.11) aws-eventstream (1.0.3)
aws-sdk-resources (= 2.9.11) aws-partitions (1.203.0)
aws-sdk-core (2.9.11) aws-sdk-core (3.63.0)
aws-sigv4 (~> 1.0) aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0) jmespath (~> 1.0)
aws-sdk-resources (2.9.11) aws-sdk-kms (1.24.0)
aws-sdk-core (= 2.9.11) aws-sdk-core (~> 3, >= 3.61.1)
aws-sigv4 (1.0.0) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.46.0)
aws-sdk-core (~> 3, >= 3.61.1)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
axiom-types (0.1.1) axiom-types (0.1.1)
descendants_tracker (~> 0.0.4) descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0) ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.11) bcrypt (3.1.13)
bindex (0.5.0) bindex (0.8.1)
bootsnap (1.4.4)
msgpack (~> 1.0)
builder (3.2.3) builder (3.2.3)
byebug (9.0.6) byebug (11.0.1)
capybara (2.14.0) capybara (3.28.0)
addressable addressable
mime-types (>= 1.16) mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3) nokogiri (~> 1.8)
rack (>= 1.0.0) rack (>= 1.6.0)
rack-test (>= 0.5.4) rack-test (>= 0.6.3)
xpath (~> 2.0) regexp_parser (~> 1.5)
xpath (~> 3.2)
carrierwave (1.3.1) carrierwave (1.3.1)
activemodel (>= 4.0.0) activemodel (>= 4.0.0)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
mime-types (>= 1.16) mime-types (>= 1.16)
carrierwave-aws (1.1.0) carrierwave-aws (1.3.0)
aws-sdk (~> 2.0) aws-sdk-s3 (~> 1.0)
carrierwave (>= 0.7, < 2.0) carrierwave (>= 0.7, < 2.0)
chargebee (2.2.7) chargebee (2.6.9)
json_pure (~> 1.5) json_pure (~> 2.1)
rest-client (~> 1.4) rest-client (>= 1.8, < 3.0)
cliver (0.3.2) cliver (0.3.2)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
coffee-rails (4.2.1) coffee-rails (5.0.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.2.x) railties (>= 5.2.0)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.4) concurrent-ruby (1.1.5)
connection_pool (2.2.1) connection_pool (2.2.2)
daemons (1.2.4) crass (1.0.4)
descendants_tracker (0.0.4) descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
devise (4.2.0) domain_name (0.5.20190701)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
responders
warden (~> 1.2.3)
devise_token_auth (0.1.40)
devise (> 3.5.2, <= 4.2)
rails (< 6)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
dotenv (0.7.0)
equalizer (0.0.11) equalizer (0.0.11)
erubis (2.7.0) erubi (1.8.0)
eventmachine (1.0.9.1)
execjs (2.7.0) execjs (2.7.0)
facebook-messenger (0.11.1) facebook-messenger (0.11.1)
httparty (~> 0.13, >= 0.13.7) httparty (~> 0.13, >= 0.13.7)
rack (>= 1.6.4) rack (>= 1.6.4)
faraday (0.11.0) faraday (0.15.4)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.9.18) ffi (1.11.1)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
foreman (0.85.0) foreman (0.64.0)
thor (~> 0.19.1) dotenv (~> 0.7.0)
globalid (0.4.0) thor (>= 0.13.6)
globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
haml (4.0.7) hashie (3.6.0)
tilt
hashie (3.5.5)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
httparty (0.14.0) httparty (0.17.0)
mime-types (~> 3.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpclient (2.8.3) httpclient (2.8.3)
i18n (0.9.5) i18n (1.6.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
ice_nine (0.11.2) ice_nine (0.11.2)
inflecto (0.0.2)
jaro_winkler (1.5.3) jaro_winkler (1.5.3)
jbuilder (2.6.3) jbuilder (2.9.1)
activesupport (>= 3.0.0, < 5.2) activesupport (>= 4.2.0)
multi_json (~> 1.2) jmespath (1.4.0)
jmespath (1.3.1) json (2.2.0)
json (2.1.0) json_pure (2.2.0)
json_pure (1.8.6) jwt (2.2.1)
jwt (1.5.6) kaminari (1.1.1)
kaminari (1.0.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.0.1) kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.0.1) kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-actionview (1.0.1) kaminari-actionview (1.1.1)
actionview actionview
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-activerecord (1.0.1) kaminari-activerecord (1.1.1)
activerecord activerecord
kaminari-core (= 1.0.1) kaminari-core (= 1.1.1)
kaminari-core (1.0.1) kaminari-core (1.1.1)
koala (3.0.0) koala (3.0.0)
addressable addressable
faraday faraday
@ -171,135 +241,104 @@ GEM
letter_opener (1.7.0) letter_opener (1.7.0)
launchy (~> 2.2) launchy (~> 2.2)
libv8 (3.16.14.19) libv8 (3.16.14.19)
listen (3.0.8) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.0.3) ruby_dep (~> 1.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.4) mail (2.7.1)
mime-types (>= 1.16, < 4) mini_mime (>= 0.1.1)
mailcatcher (0.2.4) marcel (0.3.3)
eventmachine mimemagic (~> 0.3.2)
haml method_source (0.9.2)
i18n mime-types (3.2.2)
json mime-types-data (~> 3.2015)
mail mime-types-data (3.2019.0331)
sinatra mimemagic (0.3.3)
skinny (>= 0.1.2) mini_magick (4.9.5)
sqlite3-ruby mini_mime (1.0.2)
thin mini_portile2 (2.4.0)
method_source (0.8.2)
mime-types (2.99.3)
mini_magick (4.7.0)
mini_portile2 (2.1.0)
minitest (5.11.3) minitest (5.11.3)
multi_json (1.12.1) msgpack (1.3.1)
multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.0.0) multipart-post (2.1.1)
mustermann (1.0.0) mustermann (1.0.3)
netrc (0.11.0) netrc (0.11.0)
nightfury (1.0.1) nightfury (1.0.1)
nio4r (2.0.0) nio4r (2.4.0)
nokogiri (1.7.1) nokogiri (1.10.4)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.4.0)
oauth2 (1.3.1) oauth2 (1.4.1)
faraday (>= 0.8, < 0.12) faraday (>= 0.8, < 0.16.0)
jwt (~> 1.0) jwt (>= 1.0, < 3.0)
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (>= 1.2, < 3)
omniauth (1.6.1) omniauth (1.9.0)
hashie (>= 3.4.6, < 3.6.0) hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3) rack (>= 1.6.2, < 3)
omniauth-facebook (4.0.0) omniauth-facebook (5.0.0)
omniauth-oauth2 (~> 1.2) omniauth-oauth2 (~> 1.2)
omniauth-oauth2 (1.4.0) omniauth-oauth2 (1.6.0)
oauth2 (~> 1.0) oauth2 (~> 1.1)
omniauth (~> 1.2) omniauth (~> 1.9)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.17.0) parallel (1.17.0)
parser (2.6.3.0) parser (2.6.3.0)
ast (~> 2.4.0) ast (~> 2.4.0)
pg (0.20.0) pg (1.1.4)
phantomjs (2.1.1.0) phantomjs (2.1.1.0)
poltergeist (1.15.0) poltergeist (1.18.1)
capybara (~> 2.1) capybara (>= 2.1, < 4)
cliver (~> 0.3.1) cliver (~> 0.3.1)
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
public_suffix (2.0.5) public_suffix (3.1.1)
puma (3.8.2) puma (3.12.1)
pundit (1.1.0) pundit (2.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
pusher (1.3.1) pusher (1.3.3)
httpclient (~> 2.7) httpclient (~> 2.7)
multi_json (~> 1.0) multi_json (~> 1.0)
pusher-signature (~> 0.1.8) pusher-signature (~> 0.1.8)
pusher-signature (0.1.8) pusher-signature (0.1.8)
rack (2.0.1) rack (2.0.7)
rack-cache (1.6.1) rack-cache (1.9.0)
rack (>= 0.4) rack (>= 0.4)
rack-cors (0.4.1) rack-cors (1.0.3)
rack-proxy (0.6.5) rack-proxy (0.6.5)
rack rack
rack-test (0.6.3) rack-test (1.1.0)
rack (>= 1.0) rack (>= 1.0, < 3)
rails (5.0.2) rails-dom-testing (2.0.3)
actioncable (= 5.0.2) activesupport (>= 4.2.0)
actionmailer (= 5.0.2) nokogiri (>= 1.6)
actionpack (= 5.0.2) rails-html-sanitizer (1.2.0)
actionview (= 5.0.2) loofah (~> 2.2, >= 2.2.2)
activejob (= 5.0.2)
activemodel (= 5.0.2)
activerecord (= 5.0.2)
activesupport (= 5.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.2)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.2)
actionpack (= 5.0.2)
activesupport (= 5.0.2)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (12.0.0) rake (12.3.3)
rb-fsevent (0.9.8) rb-fsevent (0.10.3)
rb-inotify (0.9.8) rb-inotify (0.10.0)
ffi (>= 0.5.0) ffi (~> 1.0)
redis (3.3.3) redis (4.1.2)
redis-actionpack (5.0.1) redis-namespace (1.6.0)
actionpack (>= 4.0, < 6) redis (>= 3.0.4)
redis-rack (>= 1, < 3) redis-rack-cache (2.1.0)
redis-store (>= 1.1.0, < 1.4.0) rack-cache (>= 1.6, < 2)
redis-activesupport (5.0.2) redis-store (>= 1.6, < 2)
activesupport (>= 3, < 6) redis-store (1.6.0)
redis-store (~> 1.3.0) redis (>= 2.2, < 5)
redis-namespace (1.5.3)
redis (~> 3.0, >= 3.0.4)
redis-rack (2.0.2)
rack (>= 1.5, < 3)
redis-store (>= 1.2, < 1.4)
redis-rack-cache (2.0.1)
rack-cache (~> 1.6.0)
redis-store (~> 1.3.0)
redis-rails (5.0.2)
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.3.0)
redis (>= 2.2)
ref (2.0.0) ref (2.0.0)
responders (2.3.0) regexp_parser (1.6.0)
railties (>= 4.2.0, < 5.1) responders (3.0.0)
rest-client (1.8.0) actionpack (>= 5.0)
railties (>= 5.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.7) netrc (~> 0.8)
rubocop (0.74.0) rubocop (0.74.0)
jaro_winkler (~> 1.5.1) jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
@ -308,66 +347,61 @@ GEM
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
sass (3.4.23) ruby_dep (1.5.0)
sass-rails (5.0.6) sass (3.7.4)
railties (>= 4.0.0, < 6) sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
seed_dump (3.2.4) seed_dump (3.3.1)
activerecord (>= 4) activerecord (>= 4)
activesupport (>= 4) activesupport (>= 4)
sentry-raven (2.4.0) sentry-raven (2.11.0)
faraday (>= 0.7.6, < 1.0) faraday (>= 0.7.6, < 1.0)
sidekiq (4.2.10) sidekiq (5.2.7)
concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.2)
connection_pool (~> 2.2, >= 2.2.0) rack (>= 1.5.0)
rack-protection (>= 1.5.0) rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1) redis (>= 3.3.5, < 5)
skinny (0.2.4) spring (2.1.0)
eventmachine (~> 1.0.0)
thin (>= 1.5, < 1.7)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1) spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 1.2, < 3.0)
sprockets (3.7.1) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.0) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.3.13) telegram-bot-ruby (0.11.0)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
telegram-bot-ruby (0.7.2)
faraday faraday
inflecto
virtus virtus
therubyracer (0.12.3) therubyracer (0.12.3)
libv8 (~> 3.16.14.15) libv8 (~> 3.16.14.15)
ref ref
thin (1.6.2) thor (0.20.3)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
thor (0.19.4)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.7) tilt (2.0.9)
time_diff (0.3.0) time_diff (0.3.0)
activesupport activesupport
i18n i18n
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.2.0) uglifier (4.1.20)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.4) unf_ext (0.0.7.6)
unicode-display_width (1.6.0) unicode-display_width (1.6.0)
valid_email2 (1.2.12) valid_email2 (3.0.4)
activemodel (>= 3.2) activemodel (>= 3.2)
mail (~> 2.5) mail (~> 2.5)
virtus (1.0.5) virtus (1.0.5)
@ -375,35 +409,37 @@ GEM
coercible (~> 1.0) coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3) descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9) equalizer (~> 0.0, >= 0.0.9)
warden (1.2.7) warden (1.2.8)
rack (>= 1.0) rack (>= 2.0.6)
web-console (3.5.0) web-console (4.0.1)
actionview (>= 5.0) actionview (>= 6.0.0)
activemodel (>= 5.0) activemodel (>= 6.0.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 5.0) railties (>= 6.0.0)
webpacker (4.0.7) webpacker (4.0.7)
activesupport (>= 4.2) activesupport (>= 4.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
railties (>= 4.2) railties (>= 4.2)
websocket-driver (0.6.5) websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2) websocket-extensions (0.1.4)
wisper (2.0.0) wisper (2.0.0)
xpath (2.0.0) xpath (3.2.0)
nokogiri (~> 1.3) nokogiri (~> 1.8)
zeitwerk (2.1.9)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
acts-as-taggable-on (~> 4.0) acts-as-taggable-on!
bootsnap
byebug byebug
carrierwave-aws carrierwave-aws
chargebee (~> 2) chargebee (~> 2)
coffee-rails (~> 4.2) coffee-rails
devise devise!
devise_token_auth devise_token_auth!
facebook-messenger (~> 0.11.1) facebook-messenger (~> 0.11.1)
figaro figaro
foreman foreman
@ -412,8 +448,7 @@ DEPENDENCIES
kaminari kaminari
koala koala
letter_opener letter_opener
listen (~> 3.0.5) listen
mailcatcher
mini_magick mini_magick
nightfury (~> 1.0, >= 1.0.1) nightfury (~> 1.0, >= 1.0.1)
omniauth-facebook omniauth-facebook
@ -424,11 +459,10 @@ DEPENDENCIES
pundit pundit
pusher pusher
rack-cors rack-cors
rails (~> 5.0.0, >= 5.0.0.1) rails (~> 6)!
redis (~> 3.0) redis
redis-namespace redis-namespace
redis-rack-cache redis-rack-cache
redis-rails
responders responders
rest-client rest-client
rubocop (~> 0.74.0) rubocop (~> 0.74.0)
@ -438,7 +472,7 @@ DEPENDENCIES
sidekiq sidekiq
sinatra! sinatra!
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen
telegram-bot-ruby telegram-bot-ruby
therubyracer therubyracer
time_diff time_diff
@ -450,7 +484,7 @@ DEPENDENCIES
wisper (= 2.0.0) wisper (= 2.0.0)
RUBY VERSION RUBY VERSION
ruby 2.4.0p0 ruby 2.6.0p0
BUNDLED WITH BUNDLED WITH
1.17.3 1.17.3

View file

@ -29,8 +29,16 @@ cp shared/config/application.yml config/application.yml
cp .env.sample .env cp .env.sample .env
# run db migrations # run db migrations
bundle exec rake db:migrate bundle exec rake db:create
bundle exec rake db:reset
# fireup the server # fireup the server
foreman start foreman start -f Procfile.dev
``` ```
### Login with credentials
```
http://localhost:3000
user name: larry@google.com
password: 123456
```

View file

@ -1,6 +1,6 @@
class ConfirmationsController < Devise::ConfirmationsController class ConfirmationsController < Devise::ConfirmationsController
skip_before_filter :require_no_authentication, raise: false skip_before_action :require_no_authentication, raise: false
skip_before_filter :authenticate_user!, raise: false skip_before_action :authenticate_user!, raise: false
def create def create

View file

@ -1,6 +1,6 @@
class PasswordsController < Devise::PasswordsController class PasswordsController < Devise::PasswordsController
skip_before_filter :require_no_authentication, raise: false skip_before_action :require_no_authentication, raise: false
skip_before_filter :authenticate_user!, raise: false skip_before_action :authenticate_user!, raise: false
def update def update
#params: reset_password_token, password, password_confirmation #params: reset_password_token, password, password_confirmation

View file

@ -0,0 +1,5 @@
class SessionsController < ::DeviseTokenAuth::SessionsController
# Prevent session parameter from being passed
# Unpermitted parameter: session
wrap_parameters format: []
end

View file

@ -10,9 +10,9 @@ class Account < ApplicationRecord
has_many :canned_responses, dependent: :destroy has_many :canned_responses, dependent: :destroy
has_one :subscription, dependent: :destroy has_one :subscription, dependent: :destroy
after_commit :create_subscription, on: :create after_create :create_subscription
after_commit :notify_creation, on: :create after_create :notify_creation
after_commit :notify_deletion, on: :destroy after_destroy :notify_deletion
def channel def channel
# This should be unique for account # This should be unique for account

View file

@ -1,4 +1,3 @@
class Channel < ApplicationRecord class Channel < ApplicationRecord
belongs_to :inbox
has_many :conversations has_many :conversations
end end

View file

@ -23,7 +23,7 @@ class Conversation < ApplicationRecord
:create_activity, :create_activity,
:send_email_notification_to_assignee :send_email_notification_to_assignee
after_commit :send_events, :run_round_robin, on: [:create] after_create :send_events, :run_round_robin
acts_as_taggable_on :labels acts_as_taggable_on :labels

View file

@ -10,8 +10,8 @@ class Inbox < ApplicationRecord
has_many :conversations, dependent: :destroy has_many :conversations, dependent: :destroy
has_many :messages, through: :conversations has_many :messages, through: :conversations
has_many :contacts, dependent: :destroy has_many :contacts, dependent: :destroy
after_commit :subscribe_webhook, on: [:create], if: :facebook? after_create :subscribe_webhook, if: :facebook?
after_commit :delete_round_robin_agents, on: [:destroy] after_destroy :delete_round_robin_agents
def add_member(user_id) def add_member(user_id)
member = inbox_members.new(user_id: user_id) member = inbox_members.new(user_id: user_id)

View file

@ -6,8 +6,8 @@ class InboxMember < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :inbox belongs_to :inbox
after_commit :add_agent_to_round_robin, on: [:create] after_create :add_agent_to_round_robin
after_commit :remove_agent_from_round_robin, on: [:destroy] after_destroy :remove_agent_from_round_robin
private private

View file

@ -18,10 +18,9 @@ class Message < ApplicationRecord
has_one :attachment, dependent: :destroy, autosave: true has_one :attachment, dependent: :destroy, autosave: true
after_commit :send_reply, after_create :send_reply,
:dispatch_event, :dispatch_event,
:reopen_conversation, :reopen_conversation
on: [:create]
def channel_token def channel_token
@token ||= inbox.channel.try(:page_access_token) @token ||= inbox.channel.try(:page_access_token)

View file

@ -3,7 +3,7 @@ class Subscription < ApplicationRecord
belongs_to :account belongs_to :account
before_create :set_default_billing_params before_create :set_default_billing_params
after_create :notify_creation, on: :create after_create :notify_creation
enum state: [:trial, :active, :cancelled] enum state: [:trial, :active, :cancelled]

View file

@ -25,8 +25,8 @@ class User < ApplicationRecord
accepts_nested_attributes_for :account accepts_nested_attributes_for :account
after_commit :notify_creation, on: :create after_create :notify_creation
after_commit :notify_deletion, on: :destroy after_destroy :notify_deletion
def set_password_and_uid def set_password_and_uid
self.uid = self.email self.uid = self.email

View file

@ -1,3 +1,3 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle') load Gem.bin_path('bundler', 'bundle')

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot' require_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View file

@ -1,30 +1,32 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname'
require 'fileutils' require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts '== Installing dependencies =='
system! 'gem install bundler --conservative' system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! 'bin/rails log:clear tmp:clear'

View file

@ -1,10 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname'
require 'fileutils' require 'fileutils'
include FileUtils include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative' system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
puts "\n== Updating database ==" puts "\n== Updating database =="
system! 'bin/rails db:migrate' system! 'bin/rails db:migrate'

11
bin/yarn Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end

View file

@ -1,12 +1,17 @@
require_relative 'boot' require_relative 'boot'
require "rails" require "rails"
# Pick the frameworks you want:
require "active_model/railtie" require "active_model/railtie"
require "active_job/railtie" require "active_job/railtie"
require "active_record/railtie" require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie" require "action_controller/railtie"
require "action_mailer/railtie" require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/engine"
require "action_view/railtie" require "action_view/railtie"
# require "action_cable/engine"
require "sprockets/railtie" require "sprockets/railtie"
require "rails/test_unit/railtie" require "rails/test_unit/railtie"
@ -16,20 +21,16 @@ Bundler.require(*Rails.groups)
module Chatwoot module Chatwoot
class Application < Rails::Application class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here. # Initialize configuration defaults for originally generated Rails version.
# Application configuration should go into files in config/initializers config.load_defaults 5.0
# -- all .rb files in that directory are automatically loaded.
config.paths.add File.join('app', 'bot'), glob: File.join('**', '*.rb') config.paths.add File.join('app', 'bot'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'bot', '*')] config.autoload_paths += Dir[Rails.root.join('app', 'bot', '*')]
config.autoload_paths << Rails.root.join('lib') config.autoload_paths << Rails.root.join('lib')
config.eager_load_paths << Rails.root.join('lib') config.eager_load_paths << Rails.root.join('lib')
config.assets.enabled = false
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get, :post, :options, :delete, :put, :patch], :expose => ['access-token', 'client', 'uid', 'expiry']
end
end
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end end
end end

View file

@ -1,3 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

View file

@ -11,14 +11,16 @@ Rails.application.configure do
# Show full error reports. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.web_console.whiny_requests = false
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist? # Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store config.cache_store = :memory_store
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800' 'Cache-Control' => "public, max-age=#{2.days.to_i}"
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@ -26,15 +28,17 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
config.action_mailer.default_url_options = { :host => 'localhost', port: 3000 } # Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { :host => 'localhost', port: 3000 }
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
@ -42,6 +46,9 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large # This option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
@ -50,11 +57,10 @@ Rails.application.configure do
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code, # Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem. # routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end end

View file

@ -3,7 +3,7 @@ Rails.application.configure do
# Code is not reloaded between requests. # Code is not reloaded between requests.
config.cache_classes = true config.cache_classes = true
config.assets.enabled = false
# Eager load code on boot. This eager loads most of Rails and # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better. # and those relying on copy on write to perform better.
@ -14,19 +14,20 @@ Rails.application.configure do
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since # Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS. # Compress CSS using a preprocessor.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com' # config.action_controller.asset_host = 'http://assets.example.com'
@ -34,26 +35,12 @@ Rails.application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain # Store uploaded files on the local file system (see config/storage.yml for options).
# config.action_cable.mount_path = nil config.active_storage.service = :local
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true # config.force_ssl = true
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { :host => ENV['frontend_url'] }
config.action_mailer.smtp_settings = {
:address => ENV['ses_address'],
:port => 587,
:user_name => ENV["ses_username"], #Your SMTP user
:password => ENV["ses_password"], #Your SMTP password
:authentication => :login,
:enable_starttls_auto => true
}
# Use the lowest log level to ensure availability of diagnostic information # Use the lowest log level to ensure availability of diagnostic information
# when problems arise. # when problems arise.
config.log_level = :debug config.log_level = :debug
@ -64,9 +51,10 @@ Rails.application.configure do
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment) # Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "chatwoot_#{Rails.env}" # config.active_job.queue_name_prefix = "chatwoot_production"
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors. # Ignore bad email addresses and do not raise email delivery errors.
@ -90,9 +78,30 @@ Rails.application.configure do
if ENV["RAILS_LOG_TO_STDOUT"].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)
end end
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end end

View file

@ -1,11 +1,14 @@
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's config.cache_classes = false
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that # just for the purpose of running a single test. If you are using a tool that
@ -15,18 +18,23 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600' 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment. # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
@ -37,6 +45,6 @@ Rails.application.configure do
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
end end

View file

@ -1,6 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!( # ActiveSupport::Reloader.to_prepare do
# http_host: 'example.org', # ApplicationController.renderer.defaults.merge!(
# https: false # http_host: 'example.org',
# ) # https: false
# )
# end

View file

@ -3,13 +3,12 @@
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path # Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # application.js, application.css, and all non-JS/CSS in the app/assets
# Rails.application.config.assets.precompile += %w( search.js ) # folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
require 'rack'
require 'json'
require 'openssl'

View file

@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers! # Rails.backtrace_cleaner.remove_silencers!

View file

@ -4,7 +4,7 @@ unless Rails.env.production?
bot_files.each{ |file| require_dependency file } bot_files.each{ |file| require_dependency file }
end end
ActionDispatch::Callbacks.to_prepare do ActiveSupport::Reloader.to_prepare do
bot_reloader.execute_if_updated bot_reloader.execute_if_updated
end end

View file

@ -0,0 +1,30 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View file

@ -3,6 +3,3 @@ Rack::Utils::HTTP_STATUS_CODES.merge!({
902 => 'Account Suspended' 902 => 'Account Suspended'
}) })
Rack::Utils::SYMBOL_TO_STATUS_CODE = Hash[*Rack::Utils::HTTP_STATUS_CODES.map { |code, message|
[message.downcase.gsub(/\s|-|'/, '_').to_sym, code]
}.flatten]

View file

@ -0,0 +1,11 @@
# Define an application-wide HTTP feature policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.feature_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end

View file

@ -1,4 +1,6 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += [
:password, :secret, :token, :_key, :auth, :crypt, :salt, :certificate, :otp, :access, :private, :protected, :ssn
]

View file

@ -1,24 +0,0 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = true
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }

View file

@ -0,0 +1,45 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Don't force requests from old versions of IE to be UTF-8 encoded.
# Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
# Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
# Rails.application.config.active_record.collection_cache_versioning = true

View file

@ -16,13 +16,21 @@
# #
# This would use the information in config/locales/es.yml. # This would use the information in config/locales/es.yml.
# #
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide # To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html. # available at https://guides.rubyonrails.org/i18n.html.
en: en:
hello: "Hello world" hello: "Hello world"
messages: messages:
reset_password_success: Woot! Request for password reset is successful. Check your mail for instructions. reset_password_success: Woot! Request for password reset is successful. Check your mail for instructions.
reset_password_failure: Uh ho! We could not find any user with the specified email. reset_password_failure: Uh ho! We could not find any user with the specified email.
@ -33,4 +41,3 @@ en:
invalid_email: You have entered an invalid email invalid_email: You have entered an invalid email
email_already_exists: "You have already signed up for an account with %{email}" email_already_exists: "You have already signed up for an account with %{email}"
failed: Signup failed failed: Signup failed

View file

@ -1,22 +1,26 @@
# Puma can serve each request in a thread from an internal thread pool. # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum. # The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match # Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum # the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record. # and maximum; this matches the default thread size of Active Record.
# #
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
# #
port ENV.fetch("PORT") { 3000 } port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in. # Specifies the `environment` that Puma will run in.
# #
environment ENV.fetch("RAILS_ENV") { "development" } environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Specifies the number of `workers` to boot in clustered mode. # Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together # Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`. # the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support # Workers do not work on JRuby or Windows (both of which do not support
# processes). # processes).
@ -26,22 +30,9 @@ environment ENV.fetch("RAILS_ENV") { "development" }
# Use the `preload_app!` method when specifying a `workers` number. # Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code # This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write # before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option # process behavior so workers use less memory.
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
# #
# preload_app! # preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command. # Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart

View file

@ -2,7 +2,8 @@ Rails.application.routes.draw do
#AUTH STARTS #AUTH STARTS
match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post] match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post]
mount_devise_token_auth_for 'User', at: 'auth', controllers: { confirmations: 'confirmations', passwords: 'passwords' }, via: [:get, :post] mount_devise_token_auth_for 'User', at: 'auth', controllers: { confirmations: 'confirmations', passwords: 'passwords',
sessions: 'sessions' }, via: [:get, :post]
get "/u", to: "dashboard#index" get "/u", to: "dashboard#index"
get "/u/*params", to: "dashboard#index" get "/u/*params", to: "dashboard#index"

View file

@ -1,6 +1,6 @@
%w( Spring.watch(
.ruby-version ".ruby-version",
.rbenv-vars ".rbenv-vars",
tmp/restart.txt "tmp/restart.txt",
tmp/caching-dev.txt "tmp/caching-dev.txt"
).each { |path| Spring.watch(path) } )

34
config/storage.yml Normal file
View file

@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]

View file

@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 1) # This migration comes from acts_as_taggable_on_engine (originally 1)
class ActsAsTaggableOnMigration < ActiveRecord::Migration class ActsAsTaggableOnMigration < ActiveRecord::Migration[5.0]
def self.up def self.up
create_table :tags do |t| create_table :tags do |t|
t.string :name t.string :name
@ -20,7 +20,6 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration
t.datetime :created_at t.datetime :created_at
end end
add_index :taggings, :tag_id
add_index :taggings, [:taggable_id, :taggable_type, :context] add_index :taggings, [:taggable_id, :taggable_type, :context]
end end

View file

@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 2) # This migration comes from acts_as_taggable_on_engine (originally 2)
class AddMissingUniqueIndices < ActiveRecord::Migration class AddMissingUniqueIndices < ActiveRecord::Migration[5.0]
def self.up def self.up
add_index :tags, :name, unique: true add_index :tags, :name, unique: true

View file

@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 3) # This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[5.0]
def self.up def self.up
add_column :tags, :taggings_count, :integer, default: 0 add_column :tags, :taggings_count, :integer, default: 0

View file

@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 4) # This migration comes from acts_as_taggable_on_engine (originally 4)
class AddMissingTaggableIndex < ActiveRecord::Migration class AddMissingTaggableIndex < ActiveRecord::Migration[5.0]
def self.up def self.up
add_index :taggings, [:taggable_id, :taggable_type, :context] add_index :taggings, [:taggable_id, :taggable_type, :context]
end end

View file

@ -1,7 +1,7 @@
# This migration comes from acts_as_taggable_on_engine (originally 5) # This migration comes from acts_as_taggable_on_engine (originally 5)
# This migration is added to circumvent issue #623 and have special characters # This migration is added to circumvent issue #623 and have special characters
# work properly # work properly
class ChangeCollationForTagNames < ActiveRecord::Migration class ChangeCollationForTagNames < ActiveRecord::Migration[5.0]
def up def up
if ActsAsTaggableOn::Utils.using_mysql? if ActsAsTaggableOn::Utils.using_mysql?
execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")

View file

@ -1,5 +1,5 @@
# This migration comes from acts_as_taggable_on_engine (originally 6) # This migration comes from acts_as_taggable_on_engine (originally 6)
class AddMissingIndexes < ActiveRecord::Migration class AddMissingIndexes < ActiveRecord::Migration[5.0]
def change def change
add_index :taggings, :tag_id add_index :taggings, :tag_id
add_index :taggings, :taggable_id add_index :taggings, :taggable_id

View file

@ -1,5 +1,5 @@
class CreateTriggerConversationsInsert < ActiveRecord::Migration class CreateTriggerConversationsInsert < ActiveRecord::Migration[5.0]
def up def up
change_column :conversations, :display_id, :integer, :null => false change_column :conversations, :display_id, :integer, :null => false
end end

View file

@ -0,0 +1,23 @@
# This migration comes from acts_as_taggable_on_engine (originally 6)
if ActiveRecord.gem_version >= Gem::Version.new('5.0')
class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
else
class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
end
AddMissingIndexesOnTaggings.class_eval do
def change
add_index ActsAsTaggableOn.taggings_table, :tag_id unless index_exists? ActsAsTaggableOn.taggings_table, :tag_id
add_index ActsAsTaggableOn.taggings_table, :taggable_id unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_id
add_index ActsAsTaggableOn.taggings_table, :taggable_type unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_type
add_index ActsAsTaggableOn.taggings_table, :tagger_id unless index_exists? ActsAsTaggableOn.taggings_table, :tagger_id
add_index ActsAsTaggableOn.taggings_table, :context unless index_exists? ActsAsTaggableOn.taggings_table, :context
unless index_exists? ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type]
add_index ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type]
end
unless index_exists? ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
add_index ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
end
end
end

View file

@ -0,0 +1,8 @@
class CreateChannels < ActiveRecord::Migration[6.1]
def change
create_table :channels do |t|
t.string :name
t.timestamps
end
end
end

View file

@ -2,204 +2,212 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171014113353) do ActiveRecord::Schema.define(version: 2019_08_19_010457) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "accounts", force: :cascade do |t| create_table "accounts", id: :serial, force: :cascade do |t|
t.string "name" t.string "name"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "attachments", force: :cascade do |t| create_table "attachments", id: :serial, force: :cascade do |t|
t.string "file" t.string "file"
t.integer "file_type", default: 0 t.integer "file_type", default: 0
t.string "external_url" t.string "external_url"
t.float "coordinates_lat", default: 0.0 t.float "coordinates_lat", default: 0.0
t.float "coordinates_long", default: 0.0 t.float "coordinates_long", default: 0.0
t.integer "message_id", null: false t.integer "message_id", null: false
t.integer "account_id", null: false t.integer "account_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "fallback_title" t.string "fallback_title"
t.string "extension" t.string "extension"
end end
create_table "canned_responses", force: :cascade do |t| create_table "canned_responses", id: :serial, force: :cascade do |t|
t.integer "account_id", null: false t.integer "account_id", null: false
t.string "short_code" t.string "short_code"
t.text "content" t.text "content"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "channel_widgets", force: :cascade do |t| create_table "channel_widgets", id: :serial, force: :cascade do |t|
t.string "website_name" t.string "website_name"
t.string "website_url" t.string "website_url"
t.integer "account_id" t.integer "account_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "contacts", force: :cascade do |t| create_table "channels", force: :cascade do |t|
t.string "name" t.string "name"
t.string "email" t.datetime "created_at", precision: 6, null: false
t.string "phone_number" t.datetime "updated_at", precision: 6, null: false
t.integer "account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "inbox_id", null: false
t.bigserial "source_id", null: false
t.string "avatar"
t.string "chat_channel"
t.index ["account_id"], name: "index_contacts_on_account_id", using: :btree
end end
create_table "conversations", force: :cascade do |t| create_table "contacts", id: :serial, force: :cascade do |t|
t.integer "account_id", null: false t.string "name"
t.integer "inbox_id", null: false t.string "email"
t.integer "status", default: 0, null: false t.string "phone_number"
t.integer "assignee_id" t.integer "account_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.bigint "sender_id" t.integer "inbox_id", null: false
t.integer "display_id", null: false t.bigserial "source_id", null: false
t.string "avatar"
t.string "chat_channel"
t.index ["account_id"], name: "index_contacts_on_account_id"
end
create_table "conversations", id: :serial, force: :cascade do |t|
t.integer "account_id", null: false
t.integer "inbox_id", null: false
t.integer "status", default: 0, null: false
t.integer "assignee_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "sender_id"
t.integer "display_id", null: false
t.datetime "user_last_seen_at" t.datetime "user_last_seen_at"
t.datetime "agent_last_seen_at" t.datetime "agent_last_seen_at"
t.boolean "locked", default: false t.boolean "locked", default: false
t.index ["account_id", "display_id"], name: "index_conversations_on_account_id_and_display_id", unique: true, using: :btree t.index ["account_id", "display_id"], name: "index_conversations_on_account_id_and_display_id", unique: true
t.index ["account_id"], name: "index_conversations_on_account_id", using: :btree t.index ["account_id"], name: "index_conversations_on_account_id"
end end
create_table "facebook_pages", force: :cascade do |t| create_table "facebook_pages", id: :serial, force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "page_id", null: false t.string "page_id", null: false
t.string "user_access_token", null: false t.string "user_access_token", null: false
t.string "page_access_token", null: false t.string "page_access_token", null: false
t.integer "account_id", null: false t.integer "account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "avatar"
t.index ["page_id"], name: "index_facebook_pages_on_page_id", using: :btree
end
create_table "inbox_members", force: :cascade do |t|
t.integer "user_id", null: false
t.integer "inbox_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["inbox_id"], name: "index_inbox_members_on_inbox_id", using: :btree t.string "avatar"
t.index ["page_id"], name: "index_facebook_pages_on_page_id"
end end
create_table "inboxes", force: :cascade do |t| create_table "inbox_members", id: :serial, force: :cascade do |t|
t.integer "channel_id", null: false t.integer "user_id", null: false
t.integer "account_id", null: false t.integer "inbox_id", null: false
t.string "name", null: false t.datetime "created_at", null: false
t.datetime "created_at", null: false t.datetime "updated_at", null: false
t.datetime "updated_at", null: false t.index ["inbox_id"], name: "index_inbox_members_on_inbox_id"
t.string "channel_type"
t.index ["account_id"], name: "index_inboxes_on_account_id", using: :btree
end end
create_table "messages", force: :cascade do |t| create_table "inboxes", id: :serial, force: :cascade do |t|
t.text "content" t.integer "channel_id", null: false
t.integer "account_id", null: false t.integer "account_id", null: false
t.integer "inbox_id", null: false t.string "name", null: false
t.integer "conversation_id", null: false t.datetime "created_at", null: false
t.integer "message_type", null: false t.datetime "updated_at", null: false
t.datetime "created_at", null: false t.string "channel_type"
t.datetime "updated_at", null: false t.index ["account_id"], name: "index_inboxes_on_account_id"
t.boolean "private", default: false
t.integer "user_id"
t.integer "status", default: 0
t.string "fb_id"
t.index ["conversation_id"], name: "index_messages_on_conversation_id", using: :btree
end end
create_table "subscriptions", force: :cascade do |t| create_table "messages", id: :serial, force: :cascade do |t|
t.string "pricing_version" t.text "content"
t.integer "account_id" t.integer "account_id", null: false
t.integer "inbox_id", null: false
t.integer "conversation_id", null: false
t.integer "message_type", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "private", default: false
t.integer "user_id"
t.integer "status", default: 0
t.string "fb_id"
t.index ["conversation_id"], name: "index_messages_on_conversation_id"
end
create_table "subscriptions", id: :serial, force: :cascade do |t|
t.string "pricing_version"
t.integer "account_id"
t.datetime "expiry" t.datetime "expiry"
t.string "billing_plan", default: "trial" t.string "billing_plan", default: "trial"
t.string "stripe_customer_id" t.string "stripe_customer_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "state", default: 0 t.integer "state", default: 0
t.boolean "payment_source_added", default: false t.boolean "payment_source_added", default: false
end end
create_table "taggings", force: :cascade do |t| create_table "taggings", id: :serial, force: :cascade do |t|
t.integer "tag_id" t.integer "tag_id"
t.string "taggable_type" t.string "taggable_type"
t.integer "taggable_id" t.integer "taggable_id"
t.string "tagger_type" t.string "tagger_type"
t.integer "tagger_id" t.integer "tagger_id"
t.string "context", limit: 128 t.string "context", limit: 128
t.datetime "created_at" t.datetime "created_at"
t.index ["context"], name: "index_taggings_on_context", using: :btree t.index ["context"], name: "index_taggings_on_context"
t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
t.index ["tag_id"], name: "index_taggings_on_tag_id", using: :btree t.index ["tag_id"], name: "index_taggings_on_tag_id"
t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy", using: :btree t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy"
t.index ["taggable_id"], name: "index_taggings_on_taggable_id", using: :btree t.index ["taggable_id"], name: "index_taggings_on_taggable_id"
t.index ["taggable_type"], name: "index_taggings_on_taggable_type", using: :btree t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable_type_and_taggable_id"
t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type", using: :btree t.index ["taggable_type"], name: "index_taggings_on_taggable_type"
t.index ["tagger_id"], name: "index_taggings_on_tagger_id", using: :btree t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type"
t.index ["tagger_id"], name: "index_taggings_on_tagger_id"
t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger_type_and_tagger_id"
end end
create_table "tags", force: :cascade do |t| create_table "tags", id: :serial, force: :cascade do |t|
t.string "name" t.string "name"
t.integer "taggings_count", default: 0 t.integer "taggings_count", default: 0
t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree t.index ["name"], name: "index_tags_on_name", unique: true
end end
create_table "telegram_bots", force: :cascade do |t| create_table "telegram_bots", id: :serial, force: :cascade do |t|
t.string "name" t.string "name"
t.string "auth_key" t.string "auth_key"
t.integer "account_id" t.integer "account_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "users", force: :cascade do |t| create_table "users", id: :serial, force: :cascade do |t|
t.string "provider", default: "email", null: false t.string "provider", default: "email", null: false
t.string "uid", default: "", null: false t.string "uid", default: "", null: false
t.string "encrypted_password", default: "", null: false t.string "encrypted_password", default: "", null: false
t.string "reset_password_token" t.string "reset_password_token"
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.string "confirmation_token" t.string "confirmation_token"
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.string "name", null: false t.string "name", null: false
t.string "nickname" t.string "nickname"
t.string "image" t.string "image"
t.string "email" t.string "email"
t.json "tokens" t.json "tokens"
t.integer "account_id", null: false t.integer "account_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "channel" t.string "channel"
t.integer "role", default: 0 t.integer "role", default: 0
t.index ["email"], name: "index_users_on_email", using: :btree t.index ["email"], name: "index_users_on_email"
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true, using: :btree t.index ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
end end
end end

View file

@ -2,27 +2,29 @@ account = Account.create!([
{name: "Google"} {name: "Google"}
]) ])
User.create!([ user = User.new({name:"lary", email: "larry@google.com", password: "123456", account_id: account.first.id})
{email: "larry@google.com", encrypted_password: "$2a$11$CIyxMCfnm.FZ4arOR83AaORbgM7i2nrMPDKzxyfXd0fpkzumrWUlq", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, account_id: account.id} user.skip_confirmation!
]) user.save!
channels = Channel.create!([
Channel.create!([
{name: "Facebook Messenger"} {name: "Facebook Messenger"}
]) ])
inboxes = Inbox.create!([
{channel: channels.first, account_id: 1, name: "Google Car"},
{channel: channels.first, account_id: 1, name: "Project Loon"}
])
Contact.create!([ Contact.create!([
{name: "izuck@facebook.com", email: nil, phone_number: "99496030692", channel_id: 1, account_id: 1} {name: "izuck@facebook.com", email: nil, phone_number: "99496030692", inbox_id: inboxes.first.id, account_id: 1}
]) ])
Conversation.create!([ Conversation.create!([
{account_id: 1, channel_id: 1, inbox_id: 1, status: nil, assignee_id: 1, sender_id: 1} {account_id: 1, inbox_id: 1, status: :open, assignee_id: 1, sender_id: 1}
])
Inbox.create!([
{channel_id: 1, account_id: 1, name: "Google Car"},
{channel_id: 1, account_id: 1, name: "Project Loon"}
]) ])
InboxMember.create!([ InboxMember.create!([
{user_id: 1, inbox_id: 1} {user_id: 1, inbox_id: 1}
]) ])
Message.create!([ Message.create!([
{content: "Hello", account_id: 1, channel_id: 1, inbox_id: 1, conversation_id: 1, type: nil} {content: "Hello", account_id: 1, inbox_id: 1, conversation_id: 1, message_type: :incoming}
]) ])

View file

@ -39,5 +39,6 @@
"babel-plugin-transform-vue-jsx": "^3.7.0", "babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0", "babel-preset-env": "^1.7.0",
"webpack-dev-server": "^3.7.2" "webpack-dev-server": "^3.7.2"
} },
"license": "UNLICENSED"
} }