chore: Update Help Center APIs to accomodate locale (#4515)

This commit is contained in:
Pranav Raj S 2022-04-20 16:00:37 +05:30 committed by GitHub
parent 4f3a271355
commit f2f0d466f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 114 additions and 57 deletions

View file

@ -4,6 +4,6 @@ class Api::V1::Accounts::Kbase::BaseController < Api::V1::Accounts::BaseControll
private
def portal
@portal ||= Current.account.kbase_portals.find_by(id: params[:portal_id])
@portal ||= Current.account.kbase_portals.find_by(slug: params[:portal_id])
end
end

View file

@ -1,10 +1,12 @@
class Api::V1::Accounts::Kbase::PortalsController < Api::V1::Accounts::Kbase::BaseController
class Api::V1::Accounts::Kbase::PortalsController < Api::V1::Accounts::BaseController
before_action :fetch_portal, except: [:index, :create]
def index
@portals = Current.account.kbase_portals
end
def show; end
def create
@portal = Current.account.kbase_portals.create!(portal_params)
end
@ -21,7 +23,11 @@ class Api::V1::Accounts::Kbase::PortalsController < Api::V1::Accounts::Kbase::Ba
private
def fetch_portal
@portal = current_account.kbase_portals.find(params[:id])
@portal = Current.account.kbase_portals.find_by(slug: permitted_params[:id])
end
def permitted_params
params.permit(:id)
end
def portal_params