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()
|
e.preventDefault()
|
||||||
@urlStatus.attr('data-state', '')
|
@urlStatus.attr('data-state', '')
|
||||||
url = @zendeskUrl.val() + '/agent/admin/api'
|
url = @zendeskUrl.val() + '/agent/admin/api'
|
||||||
@zendeskUrlApiToken.attr('href', url.replace(/[^:]\/\//, '/'))
|
@zendeskUrlApiToken.attr('href', url.replace(/([^:])\/\/+/g, '$1/'))
|
||||||
@zendeskUrlApiToken.val('HERE')
|
@zendeskUrlApiToken.val('HERE')
|
||||||
@$('[data-slide=zendesk-url]').toggleClass('hide')
|
@$('[data-slide=zendesk-url]').toggleClass('hide')
|
||||||
@$('[data-slide=zendesk-credentials]').toggleClass('hide')
|
@$('[data-slide=zendesk-credentials]').toggleClass('hide')
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ImportZendeskController < ApplicationController
|
||||||
return if setup_done_response
|
return if setup_done_response
|
||||||
|
|
||||||
# validate
|
# validate
|
||||||
if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$}
|
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Invalid URL!',
|
message: 'Invalid URL!',
|
||||||
|
@ -50,7 +50,7 @@ class ImportZendeskController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
endpoint = "#{params[:url]}/api/v2"
|
endpoint = "#{params[:url]}/api/v2"
|
||||||
endpoint.gsub(%r{[^:]//}, '/')
|
endpoint.gsub!(%r{([^:])//+}, '\\1/')
|
||||||
Setting.set('import_zendesk_endpoint', endpoint)
|
Setting.set('import_zendesk_endpoint', endpoint)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
|
@ -94,6 +94,7 @@ class ImportZendeskController < ApplicationController
|
||||||
def import_start
|
def import_start
|
||||||
return if setup_done_response
|
return if setup_done_response
|
||||||
Setting.set('import_mode', true)
|
Setting.set('import_mode', true)
|
||||||
|
Setting.set('import_backend', 'zendesk')
|
||||||
|
|
||||||
# start migration
|
# start migration
|
||||||
Import::Zendesk.delay.start_bg
|
Import::Zendesk.delay.start_bg
|
||||||
|
|
Loading…
Reference in a new issue