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,6 +1,6 @@
class ConfirmationsController < Devise::ConfirmationsController
skip_before_filter :require_no_authentication, raise: false
skip_before_filter :authenticate_user!, raise: false
skip_before_action :require_no_authentication, raise: false
skip_before_action :authenticate_user!, raise: false
def create

View File

@@ -1,6 +1,6 @@
class PasswordsController < Devise::PasswordsController
skip_before_filter :require_no_authentication, raise: false
skip_before_filter :authenticate_user!, raise: false
skip_before_action :require_no_authentication, raise: false
skip_before_action :authenticate_user!, raise: false
def update
#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_one :subscription, dependent: :destroy
after_commit :create_subscription, on: :create
after_commit :notify_creation, on: :create
after_commit :notify_deletion, on: :destroy
after_create :create_subscription
after_create :notify_creation
after_destroy :notify_deletion
def channel
# This should be unique for account

View File

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

View File

@@ -23,7 +23,7 @@ class Conversation < ApplicationRecord
:create_activity,
: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

View File

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

View File

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

View File

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

View File

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

View File

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