Applied new rubocop.
This commit is contained in:
parent
a4e21a274b
commit
1834f77ee6
11 changed files with 27 additions and 27 deletions
|
@ -119,7 +119,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
||||||
|
|
||||||
# verify access
|
# verify access
|
||||||
return if !check_access(params[:channel_id]) if params[:channel_id]
|
return if params[:channel_id] && !check_access(params[:channel_id])
|
||||||
|
|
||||||
# connection test
|
# connection test
|
||||||
render json: EmailHelper::Probe.outbound(params, params[:email])
|
render json: EmailHelper::Probe.outbound(params, params[:email])
|
||||||
|
@ -131,7 +131,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
||||||
|
|
||||||
# verify access
|
# verify access
|
||||||
return if !check_access(params[:channel_id]) if params[:channel_id]
|
return if params[:channel_id] && !check_access(params[:channel_id])
|
||||||
|
|
||||||
# connection test
|
# connection test
|
||||||
result = EmailHelper::Probe.inbound(params)
|
result = EmailHelper::Probe.inbound(params)
|
||||||
|
@ -152,7 +152,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
channel_id = params[:channel_id]
|
channel_id = params[:channel_id]
|
||||||
|
|
||||||
# verify access
|
# verify access
|
||||||
return if !check_access(channel_id) if channel_id
|
return if channel_id && !check_access(channel_id)
|
||||||
|
|
||||||
# check account duplicate
|
# check account duplicate
|
||||||
return if email_account_duplicate?({ setting: { inbound: params[:inbound] } }, channel_id)
|
return if email_account_duplicate?({ setting: { inbound: params[:inbound] } }, channel_id)
|
||||||
|
|
|
@ -119,7 +119,7 @@ class SessionsController < ApplicationController
|
||||||
@_current_user = session[:user_id] = nil
|
@_current_user = session[:user_id] = nil
|
||||||
|
|
||||||
# reset session cookie (reset :expire_after in case remember_me is active)
|
# reset session cookie (reset :expire_after in case remember_me is active)
|
||||||
request.env['rack.session.options'][:expire_after] = -1.year
|
request.env['rack.session.options'][:expire_after] = -1.years
|
||||||
request.env['rack.session.options'][:renew] = true
|
request.env['rack.session.options'][:renew] = true
|
||||||
|
|
||||||
render json: {}
|
render json: {}
|
||||||
|
|
|
@ -275,7 +275,7 @@ returns
|
||||||
events = {}
|
events = {}
|
||||||
cal.events.each {|event|
|
cal.events.each {|event|
|
||||||
next if event.dtstart < Time.zone.now - 1.year
|
next if event.dtstart < Time.zone.now - 1.year
|
||||||
next if event.dtstart > Time.zone.now + 3.year
|
next if event.dtstart > Time.zone.now + 3.years
|
||||||
day = "#{event.dtstart.year}-#{format('%02d', event.dtstart.month)}-#{format('%02d', event.dtstart.day)}"
|
day = "#{event.dtstart.year}-#{format('%02d', event.dtstart.month)}-#{format('%02d', event.dtstart.day)}"
|
||||||
comment = event.summary || event.description
|
comment = event.summary || event.description
|
||||||
comment = Encode.conv( 'utf8', comment.to_s.force_encoding('utf-8') )
|
comment = Encode.conv( 'utf8', comment.to_s.force_encoding('utf-8') )
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Job < ApplicationModel
|
||||||
jobs.each do |job|
|
jobs.each do |job|
|
||||||
|
|
||||||
# only execute jobs, older then 1 min, to give admin posibility to change
|
# only execute jobs, older then 1 min, to give admin posibility to change
|
||||||
next if job.updated_at > Time.zone.now - 1.minutes
|
next if job.updated_at > Time.zone.now - 1.minute
|
||||||
|
|
||||||
# check if jobs need to be executed
|
# check if jobs need to be executed
|
||||||
# ignore if job was running within last 10 min.
|
# ignore if job was running within last 10 min.
|
||||||
|
|
|
@ -190,7 +190,7 @@ cleanup old online notifications
|
||||||
def self.cleanup
|
def self.cleanup
|
||||||
OnlineNotification.where('created_at < ?', Time.zone.now - 6.months).delete_all
|
OnlineNotification.where('created_at < ?', Time.zone.now - 6.months).delete_all
|
||||||
OnlineNotification.where('seen = ? AND created_at < ?', true, Time.zone.now - 4.hours).delete_all
|
OnlineNotification.where('seen = ? AND created_at < ?', true, Time.zone.now - 4.hours).delete_all
|
||||||
OnlineNotification.where('seen = ? AND updated_at < ?', true, Time.zone.now - 1.hours).delete_all
|
OnlineNotification.where('seen = ? AND updated_at < ?', true, Time.zone.now - 1.hour).delete_all
|
||||||
|
|
||||||
# notify all agents
|
# notify all agents
|
||||||
User.of_role('Agent').each {|user|
|
User.of_role('Agent').each {|user|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Service::GeoCalendar::Zammad
|
||||||
Cache.write( cache_key, data, { expires_in: 30.minutes } )
|
Cache.write( cache_key, data, { expires_in: 30.minutes } )
|
||||||
rescue => e
|
rescue => e
|
||||||
Rails.logger.error "#{host}#{url}: #{e.inspect}"
|
Rails.logger.error "#{host}#{url}: #{e.inspect}"
|
||||||
Cache.write( cache_key, data, { expires_in: 1.minutes } )
|
Cache.write( cache_key, data, { expires_in: 1.minute } )
|
||||||
end
|
end
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Sessions::Backend::Rss
|
||||||
rss_items = Rss.fetch( url, 8 )
|
rss_items = Rss.fetch( url, 8 )
|
||||||
|
|
||||||
# set new timeout
|
# set new timeout
|
||||||
Sessions::CacheIn.set( collection_key, rss_items, { expires_in: 1.hours } )
|
Sessions::CacheIn.set( collection_key, rss_items, { expires_in: 1.hour } )
|
||||||
|
|
||||||
rss_items
|
rss_items
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,14 +82,14 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if ticket and customer has been touched
|
# check if ticket and customer has been touched
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
if ticket.updated_at > 4.second.ago
|
if ticket.updated_at > 4.seconds.ago
|
||||||
assert( true, 'ticket.updated_at has been updated' )
|
assert( true, 'ticket.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'ticket.updated_at has not been updated' )
|
assert( false, 'ticket.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
if customer1.updated_at > 4.second.ago
|
if customer1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer1.updated_at has been updated' )
|
assert( true, 'customer1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer1.updated_at has not been updated' )
|
assert( false, 'customer1.updated_at has not been updated' )
|
||||||
|
@ -102,14 +102,14 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer1 and organization has been touched
|
# check if customer1 and organization has been touched
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
if customer1.updated_at > 4.second.ago
|
if customer1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer1.updated_at has been updated' )
|
assert( true, 'customer1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer1.updated_at has not been updated' )
|
assert( false, 'customer1.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'organization1.updated_at has been updated' )
|
assert( true, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'organization1.updated_at has not been updated' )
|
assert( false, 'organization1.updated_at has not been updated' )
|
||||||
|
|
|
@ -71,14 +71,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer and organization has been touched
|
# check if customer and organization has been touched
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
if customer1.updated_at > 4.second.ago
|
if customer1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer1.updated_at has been updated' )
|
assert( true, 'customer1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer1.updated_at has not been updated' )
|
assert( false, 'customer1.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'organization1.updated_at has been updated' )
|
assert( true, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'organization1.updated_at has not been updated' )
|
assert( false, 'organization1.updated_at has not been updated' )
|
||||||
|
@ -91,14 +91,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer and organization has been touched
|
# check if customer and organization has been touched
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
if customer1.updated_at > 4.second.ago
|
if customer1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer1.updated_at has been updated' )
|
assert( true, 'customer1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer1.updated_at has not been updated' )
|
assert( false, 'customer1.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'organization1.updated_at has been updated' )
|
assert( true, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'organization1.updated_at has not been updated' )
|
assert( false, 'organization1.updated_at has not been updated' )
|
||||||
|
@ -124,14 +124,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer and organization has been touched
|
# check if customer and organization has been touched
|
||||||
customer2 = User.find(customer2.id)
|
customer2 = User.find(customer2.id)
|
||||||
if customer2.updated_at > 4.second.ago
|
if customer2.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer2.updated_at has been updated' )
|
assert( true, 'customer2.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer2.updated_at has not been updated' )
|
assert( false, 'customer2.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( false, 'organization1.updated_at has been updated' )
|
assert( false, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( true, 'organization1.updated_at has not been updated' )
|
assert( true, 'organization1.updated_at has not been updated' )
|
||||||
|
@ -144,14 +144,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer and organization has been touched
|
# check if customer and organization has been touched
|
||||||
customer2 = User.find(customer2.id)
|
customer2 = User.find(customer2.id)
|
||||||
if customer2.updated_at > 4.second.ago
|
if customer2.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer2.updated_at has been updated' )
|
assert( true, 'customer2.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer2.updated_at has not been updated' )
|
assert( false, 'customer2.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( false, 'organization1.updated_at has been updated' )
|
assert( false, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( true, 'organization1.updated_at has not been updated' )
|
assert( true, 'organization1.updated_at has not been updated' )
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TokenTest < ActiveSupport::TestCase
|
||||||
create: {
|
create: {
|
||||||
user_id: 2,
|
user_id: 2,
|
||||||
action: 'PasswordReset',
|
action: 'PasswordReset',
|
||||||
created_at: 2.day.ago,
|
created_at: 2.days.ago,
|
||||||
},
|
},
|
||||||
action: 'PasswordReset',
|
action: 'PasswordReset',
|
||||||
result: nil,
|
result: nil,
|
||||||
|
@ -48,7 +48,7 @@ class TokenTest < ActiveSupport::TestCase
|
||||||
create: {
|
create: {
|
||||||
user_id: 2,
|
user_id: 2,
|
||||||
action: 'iCal',
|
action: 'iCal',
|
||||||
created_at: 2.day.ago,
|
created_at: 2.days.ago,
|
||||||
persistent: true,
|
persistent: true,
|
||||||
},
|
},
|
||||||
action: 'iCal',
|
action: 'iCal',
|
||||||
|
|
|
@ -76,7 +76,7 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if organization has been touched
|
# check if organization has been touched
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'organization1.updated_at has been updated' )
|
assert( true, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'organization1.updated_at has not been updated' )
|
assert( false, 'organization1.updated_at has not been updated' )
|
||||||
|
@ -89,21 +89,21 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check if customer1, customer2 and organization has been touched
|
# check if customer1, customer2 and organization has been touched
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
if customer1.updated_at > 4.second.ago
|
if customer1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer1.updated_at has been updated' )
|
assert( true, 'customer1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer1.updated_at has not been updated' )
|
assert( false, 'customer1.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
customer2 = User.find(customer2.id)
|
customer2 = User.find(customer2.id)
|
||||||
if customer2.updated_at > 4.second.ago
|
if customer2.updated_at > 4.seconds.ago
|
||||||
assert( true, 'customer2.updated_at has been updated' )
|
assert( true, 'customer2.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'customer2.updated_at has not been updated' )
|
assert( false, 'customer2.updated_at has not been updated' )
|
||||||
end
|
end
|
||||||
|
|
||||||
organization1 = Organization.find(organization1.id)
|
organization1 = Organization.find(organization1.id)
|
||||||
if organization1.updated_at > 4.second.ago
|
if organization1.updated_at > 4.seconds.ago
|
||||||
assert( true, 'organization1.updated_at has been updated' )
|
assert( true, 'organization1.updated_at has been updated' )
|
||||||
else
|
else
|
||||||
assert( false, 'organization1.updated_at has not been updated' )
|
assert( false, 'organization1.updated_at has not been updated' )
|
||||||
|
|
Loading…
Reference in a new issue