Fixed time zone naming. Also set default calendars on init setup based on browsers location. Ignore private ip ranges of browsers.
This commit is contained in:
parent
4944bfa809
commit
513e695894
5 changed files with 9 additions and 6 deletions
|
@ -43,6 +43,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
end
|
||||
|
||||
# return result
|
||||
Calendar.init_setup(request.remote_ip)
|
||||
render json: {
|
||||
setup_done: setup_done,
|
||||
import_mode: Setting.get('import_mode'),
|
||||
|
@ -212,10 +213,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
def setup_done_response
|
||||
return false if !setup_done
|
||||
|
||||
# get all groups
|
||||
groups = Group.where( active: true )
|
||||
|
||||
# get email addresses
|
||||
addresses = EmailAddress.where( active: true )
|
||||
|
||||
render json: {
|
||||
|
|
|
@ -22,6 +22,11 @@ returns calendar object
|
|||
|
||||
def self.init_setup(ip = nil)
|
||||
|
||||
# ignore client ip if not public ip
|
||||
if ip && ip =~ /^(::1|127\.|10\.|172\.1[6-9]\.|172\.2[0-9]\.|172\.3[0-1]\.|192\.168\.)/
|
||||
ip = nil
|
||||
end
|
||||
|
||||
# call for calendar suggestion
|
||||
calendar_details = Service::GeoCalendar.location(ip)
|
||||
return if !calendar_details
|
||||
|
|
|
@ -34,7 +34,7 @@ class Service::GeoCalendar::Zammad
|
|||
|
||||
data = response.data
|
||||
|
||||
Cache.write( cache_key, data, { expires_in: 1.day } )
|
||||
Cache.write( cache_key, data, { expires_in: 30.minutes } )
|
||||
rescue => e
|
||||
Rails.logger.error "#{host}#{url}: #{e.inspect}"
|
||||
Cache.write( cache_key, data, { expires_in: 1.minutes } )
|
||||
|
|
Loading…
Reference in a new issue