Applied new rubocop.

This commit is contained in:
Martin Edenhofer 2015-11-30 14:29:23 +01:00
parent a4e21a274b
commit 1834f77ee6
11 changed files with 27 additions and 27 deletions

View file

@ -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)
# 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
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)
# 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
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]
# verify access
return if !check_access(channel_id) if channel_id
return if channel_id && !check_access(channel_id)
# check account duplicate
return if email_account_duplicate?({ setting: { inbound: params[:inbound] } }, channel_id)

View file

@ -119,7 +119,7 @@ class SessionsController < ApplicationController
@_current_user = session[:user_id] = nil
# 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
render json: {}

View file

@ -275,7 +275,7 @@ returns
events = {}
cal.events.each {|event|
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)}"
comment = event.summary || event.description
comment = Encode.conv( 'utf8', comment.to_s.force_encoding('utf-8') )

View file

@ -26,7 +26,7 @@ class Job < ApplicationModel
jobs.each do |job|
# 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
# ignore if job was running within last 10 min.

View file

@ -190,7 +190,7 @@ cleanup old online notifications
def self.cleanup
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 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
User.of_role('Agent').each {|user|

View file

@ -37,7 +37,7 @@ class Service::GeoCalendar::Zammad
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 } )
Cache.write( cache_key, data, { expires_in: 1.minute } )
end
data
end

View file

@ -23,7 +23,7 @@ class Sessions::Backend::Rss
rss_items = Rss.fetch( url, 8 )
# 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
end

View file

@ -82,14 +82,14 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
# check if ticket and customer has been touched
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' )
else
assert( false, 'ticket.updated_at has not been updated' )
end
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' )
else
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
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' )
else
assert( false, 'customer1.updated_at has not been updated' )
end
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' )
else
assert( false, 'organization1.updated_at has not been updated' )

View file

@ -71,14 +71,14 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
# check if customer and organization has been touched
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' )
else
assert( false, 'customer1.updated_at has not been updated' )
end
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' )
else
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
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' )
else
assert( false, 'customer1.updated_at has not been updated' )
end
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' )
else
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
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' )
else
assert( false, 'customer2.updated_at has not been updated' )
end
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' )
else
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
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' )
else
assert( false, 'customer2.updated_at has not been updated' )
end
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' )
else
assert( true, 'organization1.updated_at has not been updated' )

View file

@ -37,7 +37,7 @@ class TokenTest < ActiveSupport::TestCase
create: {
user_id: 2,
action: 'PasswordReset',
created_at: 2.day.ago,
created_at: 2.days.ago,
},
action: 'PasswordReset',
result: nil,
@ -48,7 +48,7 @@ class TokenTest < ActiveSupport::TestCase
create: {
user_id: 2,
action: 'iCal',
created_at: 2.day.ago,
created_at: 2.days.ago,
persistent: true,
},
action: 'iCal',

View file

@ -76,7 +76,7 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
# check if organization has been touched
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' )
else
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
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' )
else
assert( false, 'customer1.updated_at has not been updated' )
end
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' )
else
assert( false, 'customer2.updated_at has not been updated' )
end
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' )
else
assert( false, 'organization1.updated_at has not been updated' )