Feature: Business logo API for web widget (#674)

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
Sojan Jose
2020-04-07 10:19:19 +05:30
committed by GitHub
parent e04b37dfcf
commit 4feca1d88d
11 changed files with 71 additions and 37 deletions

View File

@@ -17,7 +17,7 @@ class ContactMergeAction
def validate_contacts
return if belongs_to_account?(@base_contact) && belongs_to_account?(@mergee_contact)
raise Exception, 'contact does not belong to the account'
raise StandardError, 'contact does not belong to the account'
end
def belongs_to_account?(contact)

View File

@@ -8,7 +8,7 @@ class Api::BaseController < ApplicationController
private
def authenticate_by_access_token?
request.headers[:api_access_token].present?
request.headers[:api_access_token].present? || request.headers[:HTTP_API_ACCESS_TOKEN].present?
end
def set_conversation

View File

@@ -26,6 +26,6 @@ class Api::V1::Accounts::InboxesController < Api::BaseController
end
def inbox_update_params
params.require(:inbox).permit(:enable_auto_assignment)
params.require(:inbox).permit(:enable_auto_assignment, :avatar)
end
end

View File

@@ -5,7 +5,8 @@ module AccessTokenAuthHelper
}.freeze
def authenticate_access_token!
access_token = AccessToken.find_by(token: request.headers[:api_access_token])
token = request.headers[:api_access_token] || request.headers[:HTTP_API_ACCESS_TOKEN]
access_token = AccessToken.find_by(token: token)
render_unauthorized('Invalid Access Token') && return unless access_token
token_owner = access_token.owner

View File

@@ -3,7 +3,7 @@
# Table name: accounts
#
# id :integer not null, primary key
# locale :integer default("eng")
# locale :integer default("en")
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null

View File

@@ -20,6 +20,7 @@
class Inbox < ApplicationRecord
include Reportable
include Avatarable
validates :account_id, presence: true