Imporoved zendesk reload feature at import time. Improved url validation.
This commit is contained in:
parent
4a24bb8507
commit
f7bd2dfceb
2 changed files with 4 additions and 3 deletions
|
@ -117,7 +117,7 @@ class Index extends App.ControllerContent
|
|||
e.preventDefault()
|
||||
@urlStatus.attr('data-state', '')
|
||||
url = @zendeskUrl.val() + '/agent/admin/api'
|
||||
@zendeskUrlApiToken.attr('href', url.replace(/[^:]\/\//, '/'))
|
||||
@zendeskUrlApiToken.attr('href', url.replace(/([^:])\/\/+/g, '$1/'))
|
||||
@zendeskUrlApiToken.val('HERE')
|
||||
@$('[data-slide=zendesk-url]').toggleClass('hide')
|
||||
@$('[data-slide=zendesk-credentials]').toggleClass('hide')
|
||||
|
|
|
@ -7,7 +7,7 @@ class ImportZendeskController < ApplicationController
|
|||
return if setup_done_response
|
||||
|
||||
# validate
|
||||
if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$}
|
||||
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
|
||||
render json: {
|
||||
result: 'invalid',
|
||||
message: 'Invalid URL!',
|
||||
|
@ -50,7 +50,7 @@ class ImportZendeskController < ApplicationController
|
|||
end
|
||||
|
||||
endpoint = "#{params[:url]}/api/v2"
|
||||
endpoint.gsub(%r{[^:]//}, '/')
|
||||
endpoint.gsub!(%r{([^:])//+}, '\\1/')
|
||||
Setting.set('import_zendesk_endpoint', endpoint)
|
||||
|
||||
render json: {
|
||||
|
@ -94,6 +94,7 @@ class ImportZendeskController < ApplicationController
|
|||
def import_start
|
||||
return if setup_done_response
|
||||
Setting.set('import_mode', true)
|
||||
Setting.set('import_backend', 'zendesk')
|
||||
|
||||
# start migration
|
||||
Import::Zendesk.delay.start_bg
|
||||
|
|
Loading…
Reference in a new issue