Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
3eaac7009a
88 changed files with 633 additions and 611 deletions
35
.rubocop.yml
35
.rubocop.yml
|
@ -173,43 +173,10 @@ Style/Documentation:
|
|||
Description: 'Document classes and non-namespace modules.'
|
||||
Enabled: false
|
||||
|
||||
Style/EmptyLineBetweenDefs:
|
||||
Description: 'Use empty lines between defs.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
|
||||
Enabled: false
|
||||
|
||||
Rails/ActionFilter:
|
||||
Description: 'Enforces consistent use of action filter methods.'
|
||||
Enabled: false
|
||||
|
||||
Rails/FindBy:
|
||||
Description: 'Prefer find_by over where.first.'
|
||||
Enabled: false
|
||||
|
||||
Style/NilComparison:
|
||||
Description: 'Prefer x.nil? to x == nil.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
||||
Enabled: false
|
||||
|
||||
Style/SymbolProc:
|
||||
Description: 'Use symbols as procs instead of blocks when possible.'
|
||||
Enabled: false
|
||||
|
||||
Style/RedundantBegin:
|
||||
Description: "Don't use begin blocks when they are not needed."
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
|
||||
Enabled: false
|
||||
|
||||
Lint/UnusedBlockArgument:
|
||||
Description: 'Checks for unused block arguments.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
||||
Enabled: false
|
||||
|
||||
Lint/UnusedMethodArgument:
|
||||
Description: 'Checks for unused method arguments.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
|
||||
Enabled: false
|
||||
|
||||
Style/SignalException:
|
||||
Description: 'Checks for proper usage of fail and raise.'
|
||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
|
||||
|
@ -223,8 +190,6 @@ Metrics/AbcSize:
|
|||
|
||||
Style/RedundantSelf:
|
||||
Enabled: false
|
||||
Style/Next:
|
||||
Enabled: false
|
||||
Style/CommentIndentation:
|
||||
Enabled: false
|
||||
Metrics/CyclomaticComplexity:
|
||||
|
|
|
@ -64,6 +64,7 @@ class ApplicationController < ActionController::Base
|
|||
return if !session[:user_id]
|
||||
@_current_user = User.find( session[:user_id] )
|
||||
end
|
||||
|
||||
def current_user_set(user)
|
||||
session[:user_id] = user.id
|
||||
@_current_user = user
|
||||
|
@ -282,7 +283,6 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# model helper
|
||||
def model_create_render (object, params)
|
||||
begin
|
||||
|
||||
# create object
|
||||
generic_object = object.new( object.param_cleanup( params[object.to_app_model_url], true ) )
|
||||
|
@ -299,13 +299,12 @@ class ApplicationController < ActionController::Base
|
|||
logger.error e.backtrace.inspect
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_create_render_item (generic_object)
|
||||
render json: generic_object.attributes_with_associations, status: :created
|
||||
end
|
||||
|
||||
def model_update_render (object, params)
|
||||
begin
|
||||
|
||||
# find object
|
||||
generic_object = object.find( params[:id] )
|
||||
|
@ -322,13 +321,12 @@ class ApplicationController < ActionController::Base
|
|||
logger.error e.backtrace.inspect
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_update_render_item (generic_object)
|
||||
render json: generic_object.attributes_with_associations, status: :ok
|
||||
end
|
||||
|
||||
def model_destory_render (object, params)
|
||||
begin
|
||||
generic_object = object.find( params[:id] )
|
||||
generic_object.destroy
|
||||
model_destory_render_item()
|
||||
|
@ -337,13 +335,12 @@ class ApplicationController < ActionController::Base
|
|||
logger.error e.backtrace.inspect
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_destory_render_item ()
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
||||
def model_show_render (object, params)
|
||||
begin
|
||||
|
||||
if params[:full]
|
||||
generic_object_full = object.full( params[:id] )
|
||||
|
@ -358,13 +355,12 @@ class ApplicationController < ActionController::Base
|
|||
logger.error e.backtrace.inspect
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_show_render_item (generic_object)
|
||||
render json: generic_object.attributes_with_associations, status: :ok
|
||||
end
|
||||
|
||||
def model_index_render (object, params)
|
||||
begin
|
||||
def model_index_render (object, _params)
|
||||
generic_objects = object.all
|
||||
model_index_render_result( generic_objects )
|
||||
rescue Exception => e
|
||||
|
@ -372,7 +368,7 @@ class ApplicationController < ActionController::Base
|
|||
logger.error e.backtrace.inspect
|
||||
render json: { error: e.message }, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def model_index_render_result (generic_objects)
|
||||
render json: generic_objects, status: :ok
|
||||
end
|
||||
|
|
|
@ -231,9 +231,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
if mail_exchangers && mail_exchangers[0] && mail_exchangers[0][0]
|
||||
domains.push mail_exchangers[0][0]
|
||||
end
|
||||
provider_map.each {|provider, settings|
|
||||
provider_map.each {|_provider, settings|
|
||||
domains.each {|domain_to_check|
|
||||
if domain_to_check =~ /#{settings[:domain]}/i
|
||||
|
||||
next if domain_to_check !~ /#{settings[:domain]}/i
|
||||
|
||||
# probe inbound
|
||||
result = email_probe_inbound( settings[:inbound] )
|
||||
|
@ -254,7 +255,6 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
setting: settings,
|
||||
}
|
||||
return # rubocop:disable Lint/NonLocalExitFromIterator
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,11 +394,12 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
logger.info "INBOUND PROBE: #{config.inspect}"
|
||||
result = email_probe_inbound( config )
|
||||
logger.info "INBOUND RESULT: #{result.inspect}"
|
||||
if result[:result] == 'ok'
|
||||
|
||||
next if result[:result] != 'ok'
|
||||
|
||||
success = true
|
||||
settings[:inbound] = config
|
||||
break
|
||||
end
|
||||
}
|
||||
|
||||
if !success
|
||||
|
@ -543,11 +544,12 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
logger.info "OUTBOUND PROBE: #{config.inspect}"
|
||||
result = email_probe_outbound( config, params[:email] )
|
||||
logger.info "OUTBOUND RESULT: #{result.inspect}"
|
||||
if result[:result] == 'ok'
|
||||
|
||||
next if result[:result] != 'ok'
|
||||
|
||||
success = true
|
||||
settings[:outbound] = config
|
||||
break
|
||||
end
|
||||
}
|
||||
|
||||
if !success
|
||||
|
@ -614,7 +616,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
end
|
||||
result = email_probe_outbound( params[:outbound], params[:meta][:email], subject )
|
||||
|
||||
(1..5).each {|loop|
|
||||
(1..5).each {
|
||||
sleep 10
|
||||
|
||||
# fetch mailbox
|
||||
|
@ -635,7 +637,8 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
return # rubocop:disable Lint/NonLocalExitFromIterator
|
||||
end
|
||||
|
||||
if found && found == 'verify ok'
|
||||
next if !found
|
||||
next if found != 'verify ok'
|
||||
|
||||
# remember address
|
||||
address = EmailAddress.where( email: params[:meta][:email] ).first
|
||||
|
@ -694,7 +697,6 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
result: 'ok',
|
||||
}
|
||||
return # rubocop:disable Lint/NonLocalExitFromIterator
|
||||
end
|
||||
}
|
||||
|
||||
# check delivery for 30 sek.
|
||||
|
@ -767,15 +769,16 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
white_map = {
|
||||
'Recipient address rejected' => true,
|
||||
}
|
||||
white_map.each {|key, message|
|
||||
if e.message =~ /#{Regexp.escape(key)}/i
|
||||
white_map.each {|key, _message|
|
||||
|
||||
next if e.message !~ /#{Regexp.escape(key)}/i
|
||||
|
||||
result = {
|
||||
result: 'ok',
|
||||
settings: params,
|
||||
notice: e.message,
|
||||
}
|
||||
return result
|
||||
end
|
||||
}
|
||||
end
|
||||
message_human = ''
|
||||
|
|
|
@ -112,7 +112,7 @@ class LongPollingController < ApplicationController
|
|||
begin
|
||||
|
||||
# update last ping
|
||||
4.times {|loop|
|
||||
4.times {
|
||||
sleep 0.25
|
||||
}
|
||||
#sleep 1
|
||||
|
@ -128,7 +128,7 @@ class LongPollingController < ApplicationController
|
|||
render json: queue
|
||||
return
|
||||
end
|
||||
8.times {|loop|
|
||||
8.times {
|
||||
sleep 0.25
|
||||
}
|
||||
#sleep 2
|
||||
|
|
|
@ -20,7 +20,7 @@ curl http://localhost/api/v1/rss_fetch.json -v -u #{login}:#{password} -H "Conte
|
|||
|
||||
def fetch
|
||||
items = Rss.fetch(params[:url], params[:limit])
|
||||
if items == nil
|
||||
if items.nil?
|
||||
render json: { message: "failed to fetch #{ params[:url] }", status: :unprocessable_entity }
|
||||
return
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module ExtraCollection
|
||||
def session( collections, assets, user )
|
||||
def session( collections, assets, _user )
|
||||
|
||||
collections[ Network.to_app_model ] = Network.all
|
||||
collections[ Network::Category.to_app_model ] = Network::Category.all
|
||||
|
|
|
@ -69,7 +69,7 @@ returns
|
|||
|
||||
def self.param_cleanup(params, newObject = false)
|
||||
|
||||
if params == nil
|
||||
if params.nil?
|
||||
raise "No params for #{self}!"
|
||||
end
|
||||
|
||||
|
@ -107,7 +107,9 @@ returns
|
|||
# set relations
|
||||
self.class.reflect_on_all_associations.map { |assoc|
|
||||
real_key = assoc.name.to_s[0, assoc.name.to_s.length - 1] + '_ids'
|
||||
if params.key?( real_key.to_sym )
|
||||
|
||||
next if !params.key?( real_key.to_sym )
|
||||
|
||||
list_of_items = params[ real_key.to_sym ]
|
||||
if params[ real_key.to_sym ].class != Array
|
||||
list_of_items = [ params[ real_key.to_sym ] ]
|
||||
|
@ -117,7 +119,6 @@ returns
|
|||
list.push( assoc.klass.find(item) )
|
||||
}
|
||||
self.send( assoc.name.to_s + '=', list )
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -311,7 +312,7 @@ returns
|
|||
cache = self.cache_get( data[:id] )
|
||||
return cache if cache
|
||||
|
||||
record = self.where( id: data[:id] ).first
|
||||
record = self.find_by( id: data[:id] )
|
||||
self.cache_set( data[:id], record )
|
||||
return record
|
||||
elsif data[:name]
|
||||
|
@ -357,7 +358,7 @@ returns
|
|||
|
||||
def self.create_if_not_exists(data)
|
||||
if data[:id]
|
||||
record = self.where( id: data[:id] ).first
|
||||
record = self.find_by( id: data[:id] )
|
||||
return record if record
|
||||
elsif data[:name]
|
||||
records = self.where( name: data[:name] )
|
||||
|
@ -458,6 +459,7 @@ end
|
|||
def latest_change_set_from_observer
|
||||
self.class.latest_change_set(self.updated_at)
|
||||
end
|
||||
|
||||
def latest_change_set_from_observer_destroy
|
||||
self.class.latest_change_set(nil)
|
||||
end
|
||||
|
@ -466,7 +468,7 @@ end
|
|||
key = "#{self.new.class.name}_latest_change"
|
||||
expires_in = 31_536_000 # 1 year
|
||||
|
||||
if updated_at == nil
|
||||
if updated_at.nil?
|
||||
Cache.delete( key )
|
||||
else
|
||||
Cache.write( key, updated_at, { expires_in: expires_in } )
|
||||
|
@ -760,7 +762,7 @@ log object update activity stream, if configured - will be executed automaticall
|
|||
end
|
||||
|
||||
log = false
|
||||
self.changes.each {|key, value|
|
||||
self.changes.each {|key, _value|
|
||||
|
||||
# do not log created_at and updated_at attributes
|
||||
next if ignore_attributes[key.to_sym] == true
|
||||
|
@ -1029,6 +1031,7 @@ get assets of object list
|
|||
def attachments_buffer
|
||||
@attachments_buffer_data
|
||||
end
|
||||
|
||||
def attachments_buffer=(attachments)
|
||||
@attachments_buffer_data = attachments
|
||||
end
|
||||
|
@ -1036,7 +1039,7 @@ get assets of object list
|
|||
def attachments_buffer_check
|
||||
|
||||
# do nothing if no attachment exists
|
||||
return 1 if attachments_buffer == nil
|
||||
return 1 if attachments_buffer.nil?
|
||||
|
||||
# store attachments
|
||||
article_store = []
|
||||
|
|
|
@ -10,7 +10,7 @@ class Authorization < ApplicationModel
|
|||
validates :provider, presence: true
|
||||
|
||||
def self.find_from_hash(hash)
|
||||
auth = Authorization.where( provider: hash['provider'], uid: hash['uid'] ).first
|
||||
auth = Authorization.find_by( provider: hash['provider'], uid: hash['uid'] )
|
||||
if auth
|
||||
|
||||
# update auth tokens
|
||||
|
|
|
@ -89,11 +89,11 @@ add a avatar
|
|||
# check if avatar with url already exists
|
||||
avatar_already_exists = nil
|
||||
if data[:source] && !data[:source].empty?
|
||||
avatar_already_exists = Avatar.where(
|
||||
avatar_already_exists = Avatar.find_by(
|
||||
object_lookup_id: object_id,
|
||||
o_id: data[:o_id],
|
||||
source: data[:source],
|
||||
).first
|
||||
)
|
||||
end
|
||||
|
||||
# fetch image
|
||||
|
@ -208,11 +208,11 @@ set avatars as default
|
|||
|
||||
def self.set_default( object_name, o_id, avatar_id )
|
||||
object_id = ObjectLookup.by_name( object_name )
|
||||
avatar = Avatar.where(
|
||||
avatar = Avatar.find_by(
|
||||
object_lookup_id: object_id,
|
||||
o_id: o_id,
|
||||
id: avatar_id,
|
||||
).first
|
||||
)
|
||||
avatar.default = true
|
||||
avatar.save!
|
||||
|
||||
|
@ -308,9 +308,9 @@ returns:
|
|||
=end
|
||||
|
||||
def self.get_by_hash(hash)
|
||||
avatar = Avatar.where(
|
||||
avatar = Avatar.find_by(
|
||||
store_hash: hash,
|
||||
).first
|
||||
)
|
||||
return if !avatar
|
||||
file = Store.find(avatar.store_resize_id)
|
||||
end
|
||||
|
@ -329,11 +329,11 @@ returns:
|
|||
|
||||
def self.get_default(object_name, o_id)
|
||||
object_id = ObjectLookup.by_name( object_name )
|
||||
Avatar.where(
|
||||
Avatar.find_by(
|
||||
object_lookup_id: object_id,
|
||||
o_id: o_id,
|
||||
default: true,
|
||||
).first
|
||||
)
|
||||
end
|
||||
|
||||
def self.set_default_items(object_id, o_id, avatar_id)
|
||||
|
|
|
@ -66,35 +66,37 @@ class Channel::EmailParser
|
|||
|
||||
# set all headers
|
||||
mail.header.fields.each { |field|
|
||||
if field.name
|
||||
|
||||
next if !field.name
|
||||
|
||||
# full line, encode, ready for storage
|
||||
data[field.name.to_s.downcase.to_sym] = Encode.conv( 'utf8', field.to_s )
|
||||
|
||||
# if we need to access the lines by objects later again
|
||||
data[ "raw-#{field.name.downcase}".to_sym ] = field
|
||||
end
|
||||
}
|
||||
|
||||
# get sender
|
||||
from = nil
|
||||
['from', 'reply-to', 'return-path'].each { |item|
|
||||
if !from
|
||||
if mail[ item.to_sym ]
|
||||
|
||||
next if !mail[ item.to_sym ]
|
||||
|
||||
from = mail[ item.to_sym ].value
|
||||
end
|
||||
end
|
||||
|
||||
break if from
|
||||
}
|
||||
|
||||
# set x-any-recipient
|
||||
data['x-any-recipient'.to_sym] = ''
|
||||
['to', 'cc', 'delivered-to', 'x-original-to', 'envelope-to'].each { |item|
|
||||
if mail[item.to_sym]
|
||||
|
||||
next if !mail[item.to_sym]
|
||||
|
||||
if data['x-any-recipient'.to_sym] != ''
|
||||
data['x-any-recipient'.to_sym] += ', '
|
||||
end
|
||||
data['x-any-recipient'.to_sym] += mail[item.to_sym].to_s
|
||||
end
|
||||
}
|
||||
|
||||
# set extra headers
|
||||
|
@ -333,7 +335,7 @@ class Channel::EmailParser
|
|||
}
|
||||
|
||||
# filter( channel, mail )
|
||||
filters.each {|prio, backend|
|
||||
filters.each {|_prio, backend|
|
||||
begin
|
||||
backend.run( channel, mail )
|
||||
rescue Exception => e
|
||||
|
@ -358,10 +360,10 @@ class Channel::EmailParser
|
|||
|
||||
# create sender
|
||||
if mail[ 'x-zammad-customer-login'.to_sym ]
|
||||
user = User.where( login: mail[ 'x-zammad-customer-login'.to_sym ] ).first
|
||||
user = User.find_by( login: mail[ 'x-zammad-customer-login'.to_sym ] )
|
||||
end
|
||||
if !user
|
||||
user = User.where( email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email] ).first
|
||||
user = User.find_by( email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email] )
|
||||
end
|
||||
if !user
|
||||
user = user_create(
|
||||
|
@ -374,7 +376,10 @@ class Channel::EmailParser
|
|||
|
||||
# create to and cc user
|
||||
['raw-to', 'raw-cc'].each { |item|
|
||||
if mail[item.to_sym] && mail[item.to_sym].tree
|
||||
|
||||
next if !mail[item.to_sym]
|
||||
next if !mail[item.to_sym].tree
|
||||
|
||||
items = mail[item.to_sym].tree
|
||||
items.addresses.each {|item|
|
||||
user_create(
|
||||
|
@ -383,7 +388,6 @@ class Channel::EmailParser
|
|||
email: item.address,
|
||||
)
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
# set current user
|
||||
|
@ -403,7 +407,7 @@ class Channel::EmailParser
|
|||
end
|
||||
|
||||
if state_type.name != 'new'
|
||||
ticket.state = Ticket::State.where( name: 'open' ).first
|
||||
ticket.state = Ticket::State.find_by( name: 'open' )
|
||||
ticket.save
|
||||
end
|
||||
end
|
||||
|
@ -416,8 +420,8 @@ class Channel::EmailParser
|
|||
group_id: channel[:group_id] || 1,
|
||||
customer_id: user.id,
|
||||
title: mail[:subject] || '',
|
||||
state_id: Ticket::State.where( name: 'new' ).first.id,
|
||||
priority_id: Ticket::Priority.where( name: '2 normal' ).first.id,
|
||||
state_id: Ticket::State.find_by( name: 'new' ).id,
|
||||
priority_id: Ticket::Priority.find_by( name: '2 normal' ).id,
|
||||
)
|
||||
|
||||
set_attributes_by_x_headers( ticket, 'ticket', mail )
|
||||
|
@ -431,8 +435,8 @@ class Channel::EmailParser
|
|||
# set attributes
|
||||
article = Ticket::Article.new(
|
||||
ticket_id: ticket.id,
|
||||
type_id: Ticket::Article::Type.where( name: 'email' ).first.id,
|
||||
sender_id: Ticket::Article::Sender.where( name: 'Customer' ).first.id,
|
||||
type_id: Ticket::Article::Type.find_by( name: 'email' ).id,
|
||||
sender_id: Ticket::Article::Sender.find_by( name: 'Customer' ).id,
|
||||
body: mail[:body],
|
||||
from: mail[:from],
|
||||
to: mail[:to],
|
||||
|
@ -480,7 +484,7 @@ class Channel::EmailParser
|
|||
}
|
||||
|
||||
# filter( channel, mail )
|
||||
filters.each {|prio, backend|
|
||||
filters.each {|_prio, backend|
|
||||
begin
|
||||
backend.run( channel, mail, ticket, article, user )
|
||||
rescue Exception => e
|
||||
|
@ -496,7 +500,7 @@ class Channel::EmailParser
|
|||
def user_create(data)
|
||||
|
||||
# return existing
|
||||
user = User.where( login: data[:email].downcase ).first
|
||||
user = User.find_by( login: data[:email].downcase )
|
||||
return user if user
|
||||
|
||||
# create new user
|
||||
|
@ -504,7 +508,7 @@ class Channel::EmailParser
|
|||
|
||||
# fillup
|
||||
%w(firstname lastname).each { |item|
|
||||
if data[item.to_sym] == nil
|
||||
if data[item.to_sym].nil?
|
||||
data[item.to_sym] = ''
|
||||
end
|
||||
}
|
||||
|
@ -525,7 +529,7 @@ class Channel::EmailParser
|
|||
def set_attributes_by_x_headers( item_object, header_name, mail )
|
||||
|
||||
# loop all x-zammad-hedaer-* headers
|
||||
item_object.attributes.each {|key, value|
|
||||
item_object.attributes.each {|key, _value|
|
||||
|
||||
# ignore read only attributes
|
||||
next if key == 'updated_at'
|
||||
|
@ -541,7 +545,9 @@ class Channel::EmailParser
|
|||
if mail[ header.to_sym ]
|
||||
Rails.logger.info "header #{header} found #{mail[ header.to_sym ]}"
|
||||
item_object.class.reflect_on_all_associations.map { |assoc|
|
||||
if assoc.name.to_s == key_short
|
||||
|
||||
next if assoc.name.to_s != key_short
|
||||
|
||||
Rails.logger.info "ASSOC found #{assoc.class_name} lookup #{mail[ header.to_sym ]}"
|
||||
item = assoc.class_name.constantize
|
||||
|
||||
|
@ -554,7 +560,6 @@ class Channel::EmailParser
|
|||
item_object[key] = item.lookup( login: mail[ header.to_sym ] ).id
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'net/imap'
|
|||
|
||||
module Channel::EmailSend
|
||||
def self.send(attr, notification = false)
|
||||
channel = Channel.where( area: 'Email::Outbound', active: true ).first
|
||||
channel = Channel.find_by( area: 'Email::Outbound', active: true )
|
||||
begin
|
||||
c = eval 'Channel::' + channel[:adapter] + '.new'
|
||||
c.send(attr, channel, notification)
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
# process all database filter
|
||||
module Channel::Filter::Database
|
||||
|
||||
def self.run( channel, mail )
|
||||
def self.run( _channel, mail )
|
||||
|
||||
# process postmaster filter
|
||||
filters = PostmasterFilter.where( active: true, channel: 'email' )
|
||||
filters.each {|filter|
|
||||
Rails.logger.info " proccess filter #{filter.name} ..."
|
||||
match = true
|
||||
loop = false
|
||||
looped = false
|
||||
filter[:match].each {|key, value|
|
||||
loop = true
|
||||
looped = true
|
||||
begin
|
||||
scan = []
|
||||
if mail
|
||||
|
@ -31,12 +31,14 @@ module Channel::Filter::Database
|
|||
Rails.logger.error e.inspect
|
||||
end
|
||||
}
|
||||
if loop && match
|
||||
|
||||
next if !looped
|
||||
next if !match
|
||||
|
||||
filter[:perform].each {|key, value|
|
||||
Rails.logger.info " perform '#{ key.downcase }' = '#{value}'"
|
||||
mail[ key.downcase.to_sym ] = value
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
end
|
||||
|
|
|
@ -7,10 +7,11 @@ module Channel::Filter::Trusted
|
|||
|
||||
# check if trust x-headers
|
||||
if !channel[:trusted]
|
||||
mail.each {|key, value|
|
||||
if key =~ /^x-zammad/i
|
||||
mail.each {|key, _value|
|
||||
|
||||
next if key !~ /^x-zammad/i
|
||||
|
||||
mail.delete(key)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
class Channel::Sendmail
|
||||
def send(attr, channel, notification = false)
|
||||
def send(attr, _channel, notification = false)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
|
|
|
@ -75,7 +75,7 @@ class Channel::TWITTER2
|
|||
all_tweets.each do |tweet|
|
||||
|
||||
# check if tweet is already imported
|
||||
article = Ticket::Article.where( message_id: tweet.id.to_s ).first
|
||||
article = Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
|
||||
# check if sender already exists
|
||||
next if article
|
||||
|
@ -137,15 +137,15 @@ class Channel::TWITTER2
|
|||
[user, ticket, article]
|
||||
end
|
||||
|
||||
def fetch_user_create(tweet, sender)
|
||||
def fetch_user_create(_tweet, sender)
|
||||
# create sender in db
|
||||
# puts tweet.inspect
|
||||
# user = User.where( :login => tweet.sender.screen_name ).first
|
||||
auth = Authorization.where( uid: sender.id, provider: 'twitter' ).first
|
||||
auth = Authorization.find_by( uid: sender.id, provider: 'twitter' )
|
||||
user = nil
|
||||
if auth
|
||||
Rails.logger.info 'user_id', auth.user_id
|
||||
user = User.where( id: auth.user_id ).first
|
||||
user = User.find_by( id: auth.user_id )
|
||||
end
|
||||
if !user
|
||||
Rails.logger.info 'create user...'
|
||||
|
@ -180,13 +180,13 @@ class Channel::TWITTER2
|
|||
user
|
||||
end
|
||||
|
||||
def fetch_ticket_create(user, tweet, sender, channel, group)
|
||||
def fetch_ticket_create(user, tweet, _sender, _channel, group)
|
||||
|
||||
#Rails.logger.info '+++++++++++++++++++++++++++' + tweet.inspect
|
||||
# check if ticket exists
|
||||
if tweet.respond_to?('in_reply_to_status_id') && tweet.in_reply_to_status_id && tweet.in_reply_to_status_id.to_s != ''
|
||||
Rails.logger.info 'tweet.in_reply_to_status_id found: ' + tweet.in_reply_to_status_id.to_s
|
||||
article = Ticket::Article.where( message_id: tweet.in_reply_to_status_id.to_s ).first
|
||||
article = Ticket::Article.find_by( message_id: tweet.in_reply_to_status_id.to_s )
|
||||
if article
|
||||
Rails.logger.info 'article with id found tweet.in_reply_to_status_id found: ' + tweet.in_reply_to_status_id.to_s
|
||||
return article.ticket
|
||||
|
@ -194,14 +194,14 @@ class Channel::TWITTER2
|
|||
end
|
||||
|
||||
# find if record already exists
|
||||
article = Ticket::Article.where( message_id: tweet.id.to_s ).first
|
||||
article = Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
if article
|
||||
return article.ticket
|
||||
end
|
||||
|
||||
ticket = nil
|
||||
if @article_type == 'twitter direct-message'
|
||||
ticket = Ticket.where( customer_id: user.id ).first
|
||||
ticket = Ticket.find_by( customer_id: user.id )
|
||||
if ticket
|
||||
state_type = Ticket::StateType.where( ticket.state.state_type_id )
|
||||
if state_type.name == 'closed' || state_type.name == 'closed'
|
||||
|
@ -210,17 +210,17 @@ class Channel::TWITTER2
|
|||
end
|
||||
end
|
||||
if !ticket
|
||||
group = Group.where( name: group ).first
|
||||
group = Group.find_by( name: group )
|
||||
group_id = 1
|
||||
if group
|
||||
group_id = group.id
|
||||
end
|
||||
state = Ticket::State.where( name: 'new' ).first
|
||||
state = Ticket::State.find_by( name: 'new' )
|
||||
state_id = 1
|
||||
if state
|
||||
state_id = state.id
|
||||
end
|
||||
priority = Ticket::Priority.where( name: '2 normal' ).first
|
||||
priority = Ticket::Priority.find_by( name: '2 normal' )
|
||||
priority_id = 1
|
||||
if priority
|
||||
priority_id = priority.id
|
||||
|
@ -237,15 +237,15 @@ class Channel::TWITTER2
|
|||
ticket
|
||||
end
|
||||
|
||||
def fetch_article_create( user, ticket, tweet, sender )
|
||||
def fetch_article_create( _user, ticket, tweet, sender )
|
||||
|
||||
# find if record already exists
|
||||
article = Ticket::Article.where( message_id: tweet.id.to_s ).first
|
||||
article = Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
return article if article
|
||||
|
||||
# set ticket state to open if not new
|
||||
if ticket.state.name != 'new'
|
||||
ticket.state = Ticket::State.where( name: 'open' ).first
|
||||
ticket.state = Ticket::State.find_by( name: 'open' )
|
||||
ticket.save
|
||||
end
|
||||
|
||||
|
@ -257,8 +257,8 @@ class Channel::TWITTER2
|
|||
|
||||
article = Ticket::Article.create(
|
||||
ticket_id: ticket.id,
|
||||
type_id: Ticket::Article::Type.where( name: @article_type ).first.id,
|
||||
sender_id: Ticket::Article::Sender.where( name: 'Customer' ).first.id,
|
||||
type_id: Ticket::Article::Type.find_by( name: @article_type ).id,
|
||||
sender_id: Ticket::Article::Sender.find_by( name: 'Customer' ).id,
|
||||
body: tweet.text,
|
||||
from: sender.name,
|
||||
to: to,
|
||||
|
@ -268,9 +268,9 @@ class Channel::TWITTER2
|
|||
|
||||
end
|
||||
|
||||
def send(attr, notification = false)
|
||||
def send(attr, _notification = false)
|
||||
# Rails.logger.debug('tweeeeettttt!!!!!!')
|
||||
channel = Channel.where( area: 'Twitter::Inbound', active: true ).first
|
||||
channel = Channel.find_by( area: 'Twitter::Inbound', active: true )
|
||||
|
||||
client = Twitter::REST::Client.new do |config|
|
||||
config.consumer_key = channel[:options][:consumer_key]
|
||||
|
|
|
@ -76,7 +76,7 @@ add a new history entry for an object
|
|||
}
|
||||
history_record = nil
|
||||
if data[:id]
|
||||
history_record = History.where( id: data[:id] ).first
|
||||
history_record = History.find_by( id: data[:id] )
|
||||
end
|
||||
if history_record
|
||||
history_record.update_attributes(record)
|
||||
|
@ -98,7 +98,7 @@ remove whole history entries of an object
|
|||
=end
|
||||
|
||||
def self.remove( requested_object, requested_object_id )
|
||||
history_object = History::Object.where( name: requested_object ).first
|
||||
history_object = History::Object.find_by( name: requested_object )
|
||||
return if !history_object
|
||||
History.where(
|
||||
history_object_id: history_object.id,
|
||||
|
@ -185,11 +185,11 @@ returns
|
|||
data.delete('history_attribute_id')
|
||||
|
||||
data.delete( 'updated_at' )
|
||||
if data['id_to'] == nil && data['id_from'] == nil
|
||||
if data['id_to'].nil? && data['id_from'].nil?
|
||||
data.delete( 'id_to' )
|
||||
data.delete( 'id_from' )
|
||||
end
|
||||
if data['value_to'] == nil && data['value_from'] == nil
|
||||
if data['value_to'].nil? && data['value_from'].nil?
|
||||
data.delete( 'value_to' )
|
||||
data.delete( 'value_from' )
|
||||
end
|
||||
|
@ -198,7 +198,7 @@ returns
|
|||
end
|
||||
data.delete( 'related_history_object_id' )
|
||||
|
||||
if data['related_o_id'] == nil
|
||||
if data['related_o_id'].nil?
|
||||
data.delete( 'related_o_id' )
|
||||
end
|
||||
|
||||
|
|
|
@ -130,9 +130,7 @@ class Link < ApplicationModel
|
|||
link_object_target_id: data[:link_object_target_id],
|
||||
link_object_target_value: data[:link_object_target_value]
|
||||
)
|
||||
links.each { |link|
|
||||
link.destroy
|
||||
}
|
||||
links.each(&:destroy)
|
||||
|
||||
# from the other site
|
||||
if data.key?(:link_type)
|
||||
|
@ -146,13 +144,11 @@ class Link < ApplicationModel
|
|||
link_object_source_id: data[:link_object_target_id],
|
||||
link_object_source_value: data[:link_object_target_value]
|
||||
)
|
||||
links.each { |link|
|
||||
link.destroy
|
||||
}
|
||||
links.each(&:destroy)
|
||||
end
|
||||
|
||||
def self.link_type_get(data)
|
||||
linktype = Link::Type.where( name: data[:name] ).first
|
||||
linktype = Link::Type.find_by( name: data[:name] )
|
||||
if !linktype
|
||||
linktype = Link::Type.create(
|
||||
name: data[:name]
|
||||
|
@ -162,7 +158,7 @@ class Link < ApplicationModel
|
|||
end
|
||||
|
||||
def self.link_object_get(data)
|
||||
linkobject = Link::Object.where( name: data[:name] ).first
|
||||
linkobject = Link::Object.find_by( name: data[:name] )
|
||||
if !linkobject
|
||||
linkobject = Link::Object.create(
|
||||
name: data[:name]
|
||||
|
|
|
@ -17,7 +17,7 @@ class Locale < ApplicationModel
|
|||
|
||||
ActiveRecord::Base.transaction do
|
||||
result.data.each {|locale|
|
||||
exists = Locale.where(locale: locale['locale']).first
|
||||
exists = Locale.find_by(locale: locale['locale'])
|
||||
if exists
|
||||
exists.update(locale.symbolize_keys!)
|
||||
else
|
||||
|
|
|
@ -112,10 +112,10 @@ add a new attribute entry for an object
|
|||
data.delete(:object)
|
||||
|
||||
# check newest entry - is needed
|
||||
result = ObjectManager::Attribute.where(
|
||||
result = ObjectManager::Attribute.find_by(
|
||||
object_lookup_id: data[:object_lookup_id],
|
||||
name: data[:name],
|
||||
).first
|
||||
)
|
||||
if result
|
||||
# raise "ERROR: attribute #{data[:name]} for #{data[:object]} already exists"
|
||||
return result.update_attributes(data)
|
||||
|
@ -143,10 +143,10 @@ get the attribute model based on object and name
|
|||
data[:object_lookup_id] = ObjectLookup.by_name( data[:object] )
|
||||
end
|
||||
|
||||
ObjectManager::Attribute.where(
|
||||
ObjectManager::Attribute.find_by(
|
||||
object_lookup_id: data[:object_lookup_id],
|
||||
name: data[:name],
|
||||
).first
|
||||
)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
|
@ -6,9 +6,11 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer
|
|||
def after_create(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_destroy(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
@ -19,9 +21,7 @@ class Observer::Organization::RefObjectTouch < ActiveRecord::Observer
|
|||
return if Setting.get('import_mode')
|
||||
|
||||
# touch organizations tickets
|
||||
Ticket.select('id').where( organization_id: record.id ).each {|ticket|
|
||||
ticket.touch
|
||||
}
|
||||
Ticket.select('id').where( organization_id: record.id ).each(&:touch)
|
||||
|
||||
# touch current members
|
||||
record.member_ids.uniq.each {|user_id|
|
||||
|
|
|
@ -8,6 +8,7 @@ class Observer::Session < ActiveRecord::Observer
|
|||
def before_create(record)
|
||||
check(record)
|
||||
end
|
||||
|
||||
def before_update(record)
|
||||
check(record)
|
||||
end
|
||||
|
|
|
@ -19,6 +19,7 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer
|
|||
value_to: record.tag_item.name,
|
||||
)
|
||||
end
|
||||
|
||||
def after_destroy(record)
|
||||
|
||||
# just process ticket object tags
|
||||
|
|
|
@ -10,7 +10,7 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
|||
|
||||
# if sender is customer, do not communication
|
||||
sender = Ticket::Article::Sender.lookup( id: record.sender_id )
|
||||
return 1 if sender == nil
|
||||
return 1 if sender.nil?
|
||||
return 1 if sender['name'] == 'Customer'
|
||||
|
||||
# only apply on emails
|
||||
|
|
|
@ -2,6 +2,7 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
|||
def initialize(id)
|
||||
@article_id = id
|
||||
end
|
||||
|
||||
def perform
|
||||
record = Ticket::Article.find( @article_id )
|
||||
|
||||
|
@ -37,12 +38,14 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
|||
# add history record
|
||||
recipient_list = ''
|
||||
[:to, :cc].each { |key|
|
||||
if record[key] && record[key] != ''
|
||||
|
||||
next if !record[key]
|
||||
next if record[key] == ''
|
||||
|
||||
if recipient_list != ''
|
||||
recipient_list += ','
|
||||
end
|
||||
recipient_list += record[key]
|
||||
end
|
||||
}
|
||||
|
||||
return if recipient_list == ''
|
||||
|
|
|
@ -10,7 +10,7 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
|
|||
|
||||
# if sender is customer, do not communication
|
||||
sender = Ticket::Article::Sender.lookup( id: record.sender_id )
|
||||
return 1 if sender == nil
|
||||
return 1 if sender.nil?
|
||||
return 1 if sender['name'] == 'Customer'
|
||||
|
||||
# only apply on emails
|
||||
|
|
|
@ -10,7 +10,7 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
|
|||
|
||||
# if sender is customer, do not communication
|
||||
sender = Ticket::Article::Sender.lookup( id: record.sender_id )
|
||||
return 1 if sender == nil
|
||||
return 1 if sender.nil?
|
||||
return 1 if sender['name'] == 'Customer'
|
||||
|
||||
# only apply on tweets
|
||||
|
|
|
@ -10,7 +10,7 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
|
|||
|
||||
# if sender is customer, do not change anything
|
||||
sender = Ticket::Article::Sender.lookup( id: record.sender_id )
|
||||
return if sender == nil
|
||||
return if sender.nil?
|
||||
return if sender['name'] == 'Customer'
|
||||
|
||||
# set email attributes
|
||||
|
|
|
@ -10,7 +10,7 @@ class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer
|
|||
|
||||
# if sender is customer, do not change anything
|
||||
sender = Ticket::Article::Sender.lookup( id: record.sender_id )
|
||||
return if sender == nil
|
||||
return if sender.nil?
|
||||
return if sender['name'] == 'Customer'
|
||||
|
||||
# set from if not given
|
||||
|
|
|
@ -73,8 +73,8 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
|
|||
if sender.name == 'Customer'
|
||||
|
||||
# check if last communication is done by agent, else do not set last_contact_customer
|
||||
if record.ticket.last_contact_customer == nil ||
|
||||
record.ticket.last_contact_agent == nil ||
|
||||
if record.ticket.last_contact_customer.nil? ||
|
||||
record.ticket.last_contact_agent.nil? ||
|
||||
record.ticket.last_contact_agent.to_i > record.ticket.last_contact_customer.to_i
|
||||
|
||||
# set last_contact customer
|
||||
|
|
|
@ -19,7 +19,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
|||
|
||||
# get uniq objects
|
||||
list_objects = get_uniq_changes(list)
|
||||
list_objects.each {|ticket_id, item|
|
||||
list_objects.each {|_ticket_id, item|
|
||||
|
||||
# send background job
|
||||
Delayed::Job.enqueue( Observer::Ticket::Notification::BackgroundJob.new( item ) )
|
||||
|
@ -158,7 +158,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
|||
EventBuffer.add(e)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
def after_update(_record)
|
||||
|
||||
# return if we run import mode
|
||||
return if Setting.get('import_mode')
|
||||
|
|
|
@ -4,6 +4,7 @@ class Observer::Ticket::Notification::BackgroundJob
|
|||
def initialize(params)
|
||||
@p = params
|
||||
end
|
||||
|
||||
def perform
|
||||
ticket = Ticket.find(@p[:ticket_id])
|
||||
if @p[:article_id]
|
||||
|
@ -225,7 +226,7 @@ class Observer::Ticket::Notification::BackgroundJob
|
|||
changes
|
||||
end
|
||||
|
||||
def template_create(user, ticket, article, ticket_changes)
|
||||
def template_create(user, ticket, article, _ticket_changes)
|
||||
article_content = ''
|
||||
if article
|
||||
article_content = '<snip>
|
||||
|
@ -348,7 +349,7 @@ Changes:<br>
|
|||
template
|
||||
end
|
||||
|
||||
def template_header(user)
|
||||
def template_header(_user)
|
||||
'
|
||||
<style type="text/css">
|
||||
.header {
|
||||
|
@ -385,7 +386,7 @@ Changes:<br>
|
|||
'
|
||||
end
|
||||
|
||||
def template_footer(user, ticket, article)
|
||||
def template_footer(_user, _ticket, _article)
|
||||
'
|
||||
<p>
|
||||
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">i18n(View this directly here)</a>
|
||||
|
|
|
@ -2,6 +2,7 @@ class Observer::Ticket::OnlineNotificationSeen::BackgroundJob
|
|||
def initialize(id)
|
||||
@ticket_id = id
|
||||
end
|
||||
|
||||
def perform
|
||||
|
||||
# set all online notifications to seen
|
||||
|
|
|
@ -6,9 +6,11 @@ class Observer::Ticket::RefObjectTouch < ActiveRecord::Observer
|
|||
def after_create(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_destroy(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ class Observer::Ticket::UserTicketCounter < ActiveRecord::Observer
|
|||
def after_create(record)
|
||||
user_ticket_counter_update(record)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
user_ticket_counter_update(record)
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class Observer::Ticket::UserTicketCounter::BackgroundJob
|
|||
def initialize(id)
|
||||
@customer_id = id
|
||||
end
|
||||
|
||||
def perform
|
||||
|
||||
# open ticket count
|
||||
|
|
|
@ -6,6 +6,7 @@ class Observer::User::Geo < ActiveRecord::Observer
|
|||
def before_create(record)
|
||||
check_geo(record)
|
||||
end
|
||||
|
||||
def before_update(record)
|
||||
check_geo(record)
|
||||
end
|
||||
|
@ -17,7 +18,7 @@ class Observer::User::Geo < ActiveRecord::Observer
|
|||
|
||||
# check if geo update is needed based on old/new location
|
||||
if record.id
|
||||
current = User.where( id: record.id ).first
|
||||
current = User.find_by( id: record.id )
|
||||
return if !current
|
||||
|
||||
current_location = {}
|
||||
|
|
|
@ -6,9 +6,11 @@ class Observer::User::RefObjectTouch < ActiveRecord::Observer
|
|||
def after_create(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
||||
def after_destroy(record)
|
||||
ref_object_touch(record)
|
||||
end
|
||||
|
|
|
@ -6,6 +6,7 @@ class Observer::User::TicketOrganization < ActiveRecord::Observer
|
|||
def after_create(record)
|
||||
check_organization(record)
|
||||
end
|
||||
|
||||
def after_update(record)
|
||||
check_organization(record)
|
||||
end
|
||||
|
|
|
@ -195,7 +195,7 @@ class Package < ApplicationModel
|
|||
}
|
||||
|
||||
# verify if package can get installed
|
||||
package_db = Package.where( name: meta[:name] ).first
|
||||
package_db = Package.find_by( name: meta[:name] )
|
||||
if package_db
|
||||
if !data[:reinstall]
|
||||
if Gem::Version.new( package_db.version ) == Gem::Version.new( meta[:version] )
|
||||
|
@ -253,7 +253,7 @@ class Package < ApplicationModel
|
|||
|
||||
# Package.reinstall( package_name )
|
||||
def self.reinstall(package_name)
|
||||
package = Package.where( name: package_name ).first
|
||||
package = Package.find_by( name: package_name )
|
||||
if !package
|
||||
raise "No such package '#{package_name}'"
|
||||
end
|
||||
|
@ -300,10 +300,10 @@ class Package < ApplicationModel
|
|||
end
|
||||
|
||||
# delete package
|
||||
record = Package.where(
|
||||
record = Package.find_by(
|
||||
name: meta[:name],
|
||||
version: meta[:version],
|
||||
).first
|
||||
)
|
||||
record.destroy
|
||||
|
||||
true
|
||||
|
@ -313,7 +313,9 @@ class Package < ApplicationModel
|
|||
def self.reload_classes
|
||||
%w(app lib).each {|dir|
|
||||
Dir.glob( Rails.root.join( dir + '/**/*') ).each {|entry|
|
||||
if entry =~ /\.rb$/
|
||||
|
||||
next if entry !~ /\.rb$/
|
||||
|
||||
begin
|
||||
load entry
|
||||
rescue => e
|
||||
|
@ -321,7 +323,6 @@ class Package < ApplicationModel
|
|||
logger.error 'ERROR: ' + e.inspect
|
||||
logger.error 'Traceback: ' + e.backtrace.inspect
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
@ -339,10 +340,10 @@ class Package < ApplicationModel
|
|||
end
|
||||
|
||||
def self._get_bin( name, version )
|
||||
package = Package.where(
|
||||
package = Package.find_by(
|
||||
name: name,
|
||||
version: version,
|
||||
).first
|
||||
)
|
||||
if !package
|
||||
raise "No such package '#{name}' version '#{version}'"
|
||||
end
|
||||
|
@ -396,11 +397,11 @@ class Package < ApplicationModel
|
|||
(1..position).each {|count|
|
||||
tmp_path = tmp_path + '/' + directories[count].to_s
|
||||
}
|
||||
if tmp_path != ''
|
||||
if !File.exist?(tmp_path)
|
||||
Dir.mkdir( tmp_path, 0755)
|
||||
end
|
||||
end
|
||||
|
||||
next if tmp_path == ''
|
||||
next if File.exist?(tmp_path)
|
||||
|
||||
Dir.mkdir(tmp_path, 0755)
|
||||
}
|
||||
|
||||
# install file
|
||||
|
@ -416,7 +417,7 @@ class Package < ApplicationModel
|
|||
true
|
||||
end
|
||||
|
||||
def self._delete_file(file, permission, data)
|
||||
def self._delete_file(file, _permission, _data)
|
||||
location = @@root + '/' + file
|
||||
|
||||
# install file
|
||||
|
@ -474,20 +475,20 @@ class Package < ApplicationModel
|
|||
|
||||
# down
|
||||
if direction == 'reverse'
|
||||
done = Package::Migration.where( name: package.underscore, version: version ).first
|
||||
done = Package::Migration.find_by( name: package.underscore, version: version )
|
||||
next if !done
|
||||
logger.info "NOTICE: down package migration '#{migration}'"
|
||||
load "#{location}/#{migration}"
|
||||
classname = name.camelcase
|
||||
Kernel.const_get(classname).down
|
||||
record = Package::Migration.where( name: package.underscore, version: version ).first
|
||||
record = Package::Migration.find_by( name: package.underscore, version: version )
|
||||
if record
|
||||
record.destroy
|
||||
end
|
||||
|
||||
# up
|
||||
else
|
||||
done = Package::Migration.where( name: package.underscore, version: version ).first
|
||||
done = Package::Migration.find_by( name: package.underscore, version: version )
|
||||
next if done
|
||||
logger.info "NOTICE: up package migration '#{migration}'"
|
||||
load "#{location}/#{migration}"
|
||||
|
|
|
@ -124,7 +124,7 @@ class Scheduler < ApplicationModel
|
|||
def self.check( name, time_warning = 10, time_critical = 20 )
|
||||
time_warning_time = Time.now - time_warning.minutes
|
||||
time_critical_time = Time.now - time_critical.minutes
|
||||
scheduler = Scheduler.where( name: name ).first
|
||||
scheduler = Scheduler.find_by( name: name )
|
||||
if !scheduler
|
||||
puts "CRITICAL - no such scheduler jobs '#{name}'"
|
||||
return true
|
||||
|
|
|
@ -25,8 +25,9 @@ class Setting < ApplicationModel
|
|||
# config lookups
|
||||
config.each { |key, value|
|
||||
next if value.class.to_s != 'String'
|
||||
config[key].gsub!( /\#\{config\.(.+?)\}/ ) { |s|
|
||||
s = config[$1].to_s
|
||||
|
||||
config[key].gsub!( /\#\{config\.(.+?)\}/ ) {
|
||||
config[$1].to_s
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +37,7 @@ class Setting < ApplicationModel
|
|||
end
|
||||
|
||||
def self.set(name, value)
|
||||
setting = Setting.where( name: name ).first
|
||||
setting = Setting.find_by( name: name )
|
||||
if !setting
|
||||
raise "Can't find config setting '#{name}'"
|
||||
end
|
||||
|
@ -55,9 +56,11 @@ class Setting < ApplicationModel
|
|||
def delete_cache
|
||||
@@current[:settings_config] = nil
|
||||
end
|
||||
|
||||
def set_initial
|
||||
self.state_initial = self.state
|
||||
end
|
||||
|
||||
def state_check
|
||||
|
||||
return if !(self.state || self.state == false)
|
||||
|
|
|
@ -140,7 +140,7 @@ returns
|
|||
end
|
||||
|
||||
def content
|
||||
file = Store::File.where( id: self.store_file_id ).first
|
||||
file = Store::File.find_by( id: self.store_file_id )
|
||||
if !file
|
||||
raise "No such file #{ self.store_file_id }!"
|
||||
end
|
||||
|
@ -148,7 +148,7 @@ returns
|
|||
end
|
||||
|
||||
def provider
|
||||
file = Store::File.where( id: self.store_file_id ).first
|
||||
file = Store::File.find_by( id: self.store_file_id )
|
||||
if !file
|
||||
raise "No such file #{ self.store_file_id }!"
|
||||
end
|
||||
|
|
|
@ -9,8 +9,8 @@ class Store
|
|||
def self.add(data)
|
||||
sha = Digest::SHA256.hexdigest( data )
|
||||
|
||||
file = Store::File.where( sha: sha ).first
|
||||
if file == nil
|
||||
file = Store::File.find_by( sha: sha )
|
||||
if file.nil?
|
||||
|
||||
# load backend based on config
|
||||
adapter_name = Setting.get('storage_provider') || 'DB'
|
||||
|
@ -34,7 +34,7 @@ class Store
|
|||
c = adapter.get( self.sha )
|
||||
else
|
||||
# fallback until migration is done
|
||||
c = Store::Provider::DB.where( md5: self.md5 ).first.data
|
||||
c = Store::Provider::DB.find_by( md5: self.md5 ).data
|
||||
end
|
||||
c
|
||||
end
|
||||
|
@ -46,13 +46,14 @@ class Store
|
|||
content = item.content
|
||||
sha = Digest::SHA256.hexdigest( content )
|
||||
logger.info "CHECK: Store::File.find(#{item.id}) "
|
||||
if sha != item.sha
|
||||
|
||||
next if sha == item.sha
|
||||
|
||||
success = false
|
||||
logger.error "DIFF: sha diff of Store::File.find(#{item.id}) "
|
||||
if fix_it
|
||||
item.update_attribute( :sha, sha )
|
||||
end
|
||||
end
|
||||
}
|
||||
success
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class Store
|
|||
end
|
||||
|
||||
def self.get(sha)
|
||||
file = Store::Provider::DB.where( sha: sha ).first
|
||||
file = Store::Provider::DB.find_by( sha: sha )
|
||||
return if !file
|
||||
file.data
|
||||
end
|
||||
|
|
|
@ -43,9 +43,7 @@ class Tag < ApplicationModel
|
|||
tag_item_id: tag_item_id,
|
||||
o_id: data[:o_id],
|
||||
)
|
||||
result.each { |item|
|
||||
item.destroy
|
||||
}
|
||||
result.each(&:destroy)
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -81,7 +79,7 @@ class Tag < ApplicationModel
|
|||
return @@cache_item[ name ] if @@cache_item[ name ]
|
||||
|
||||
# lookup
|
||||
tag_item = Tag::Item.where( name: name ).first
|
||||
tag_item = Tag::Item.find_by( name: name )
|
||||
if tag_item
|
||||
@@cache_item[ name ] = tag_item.id
|
||||
return tag_item.id
|
||||
|
@ -112,7 +110,7 @@ class Tag < ApplicationModel
|
|||
return @@cache_object[ name ] if @@cache_object[ name ]
|
||||
|
||||
# lookup
|
||||
tag_object = Tag::Object.where( name: name ).first
|
||||
tag_object = Tag::Object.find_by( name: name )
|
||||
if tag_object
|
||||
@@cache_object[ name ] = tag_object.id
|
||||
return tag_object.id
|
||||
|
|
|
@ -11,6 +11,7 @@ class Taskbar < ApplicationModel
|
|||
def update_last_contact
|
||||
self.last_contact = Time.now
|
||||
end
|
||||
|
||||
def set_user
|
||||
self.user_id = UserInfo.current_user_id
|
||||
end
|
||||
|
|
|
@ -128,9 +128,7 @@ returns
|
|||
def merge_to(data)
|
||||
|
||||
# update articles
|
||||
Ticket::Article.where( ticket_id: self.id ).each {|article|
|
||||
article.touch
|
||||
}
|
||||
Ticket::Article.where( ticket_id: self.id ).each(&:touch)
|
||||
|
||||
# quiet update of reassign of articles
|
||||
Ticket::Article.where( ticket_id: self.id ).update_all( ['ticket_id = ?', data[:ticket_id] ] )
|
||||
|
@ -166,7 +164,7 @@ returns
|
|||
self.state_id = Ticket::State.lookup( name: 'merged' ).id
|
||||
|
||||
# rest owner
|
||||
self.owner_id = User.where( login: '-' ).first.id
|
||||
self.owner_id = User.find_by( login: '-' ).id
|
||||
|
||||
# save ticket
|
||||
self.save
|
||||
|
|
|
@ -18,9 +18,7 @@ returns
|
|||
state_list_open = Ticket::State.by_category( 'open' )
|
||||
|
||||
tickets = Ticket.where( state_id: state_list_open )
|
||||
tickets.each {|ticket|
|
||||
ticket.escalation_calculation
|
||||
}
|
||||
tickets.each(&:escalation_calculation)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
@ -175,7 +173,7 @@ returns
|
|||
def escalation_calculation_get_sla
|
||||
sla_selected = nil
|
||||
sla_list = Cache.get( 'SLA::List::Active' )
|
||||
if sla_list == nil
|
||||
if sla_list.nil?
|
||||
sla_list = Sla.where( active: true )
|
||||
Cache.write( 'SLA::List::Active', sla_list, { expires_in: 1.hour } )
|
||||
end
|
||||
|
@ -189,7 +187,9 @@ returns
|
|||
[ 'tickets.group_id', 'group_id' ]
|
||||
]
|
||||
map.each {|item|
|
||||
if sla.condition[ item[0] ]
|
||||
|
||||
next if !sla.condition[ item[0] ]
|
||||
|
||||
if sla.condition[ item[0] ].class == String
|
||||
sla.condition[ item[0] ] = [ sla.condition[ item[0] ] ]
|
||||
end
|
||||
|
@ -198,7 +198,6 @@ returns
|
|||
else
|
||||
hit = false
|
||||
end
|
||||
end
|
||||
}
|
||||
if hit
|
||||
sla_selected = sla
|
||||
|
|
|
@ -18,9 +18,9 @@ returns
|
|||
def self.generate
|
||||
|
||||
# generate number
|
||||
(1..50_000).each { |i|
|
||||
(1..50_000).each {
|
||||
number = adapter.generate
|
||||
ticket = Ticket.where( number: number ).first
|
||||
ticket = Ticket.find_by( number: number )
|
||||
return number if !ticket
|
||||
}
|
||||
raise "Can't generate new ticket number!"
|
||||
|
|
|
@ -75,9 +75,9 @@ module Ticket::Number::Date
|
|||
|
||||
# probe format
|
||||
if string =~ /#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,50})/i
|
||||
ticket = Ticket.where( number: $1 ).first
|
||||
ticket = Ticket.find_by( number: $1 )
|
||||
elsif string =~ /#{ticket_hook}\s{0,2}(#{system_id}\d{2,50})/i
|
||||
ticket = Ticket.where( number: $1 ).first
|
||||
ticket = Ticket.find_by( number: $1 )
|
||||
end
|
||||
ticket
|
||||
end
|
||||
|
|
|
@ -31,11 +31,12 @@ module Ticket::Number::Increment
|
|||
min_digs = min_digs.to_i - 1
|
||||
end
|
||||
fillup = Setting.get('system_id') || '1'
|
||||
( 1..100 ).each do |i|
|
||||
if ( fillup.length.to_i + counter_increment.to_s.length.to_i ) < min_digs.to_i
|
||||
( 1..100 ).each {
|
||||
|
||||
next if ( fillup.length.to_i + counter_increment.to_s.length.to_i ) >= min_digs.to_i
|
||||
|
||||
fillup = fillup + '0'
|
||||
end
|
||||
end
|
||||
}
|
||||
number = fillup.to_s + counter_increment.to_s
|
||||
|
||||
# calculate a checksum
|
||||
|
@ -78,9 +79,9 @@ module Ticket::Number::Increment
|
|||
|
||||
# probe format
|
||||
if string =~ /#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,48})/i
|
||||
ticket = Ticket.where( number: $1 ).first
|
||||
ticket = Ticket.find_by( number: $1 )
|
||||
elsif string =~ /#{ticket_hook}\s{0,2}(#{system_id}\d{2,48})/i
|
||||
ticket = Ticket.where( number: $1 ).first
|
||||
ticket = Ticket.find_by( number: $1 )
|
||||
end
|
||||
ticket
|
||||
end
|
||||
|
|
|
@ -73,12 +73,17 @@ returns
|
|||
|
||||
# replace e.g. 'current_user.id' with current_user.id
|
||||
overview.condition.each { |item, value|
|
||||
if value && value.class.to_s == 'String'
|
||||
|
||||
next if !value
|
||||
next if value.class.to_s != 'String'
|
||||
|
||||
parts = value.split( '.', 2 )
|
||||
if parts[0] && parts[1] && parts[0] == 'current_user'
|
||||
|
||||
next if !parts[0]
|
||||
next if !parts[1]
|
||||
next if parts[0] != 'current_user'
|
||||
|
||||
overview.condition[item] = data[:current_user][parts[1].to_sym]
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,14 @@ returns
|
|||
state_ids.push params[:ticket].state.id
|
||||
end
|
||||
state_types.each {|type|
|
||||
state_type = Ticket::StateType.where( name: type ).first
|
||||
if state_type
|
||||
state_type = Ticket::StateType.find_by( name: type )
|
||||
|
||||
next if !state_type
|
||||
|
||||
state_type.states.each {|state|
|
||||
assets = state.assets(assets)
|
||||
state_ids.push state.id
|
||||
}
|
||||
end
|
||||
}
|
||||
filter[:state_id] = state_ids
|
||||
|
||||
|
|
|
@ -83,21 +83,22 @@ returns
|
|||
end
|
||||
|
||||
# check file size
|
||||
if attachment.content && attachment.content.size / 1024 <= attachment_max_size_in_mb * 1024
|
||||
next if !attachment.content
|
||||
next if attachment.content.size / 1024 > attachment_max_size_in_mb * 1024
|
||||
|
||||
# check ignored files
|
||||
if attachment.filename
|
||||
next if !attachment.filename
|
||||
|
||||
filename_extention = attachment.filename.downcase
|
||||
filename_extention.gsub!(/^.*(\..+?)$/, '\\1')
|
||||
if !attachments_ignore.include?( filename_extention.downcase )
|
||||
|
||||
next if attachments_ignore.include?( filename_extention.downcase )
|
||||
|
||||
data = {
|
||||
'_name' => attachment.filename,
|
||||
'_content' => Base64.encode64( attachment.content )
|
||||
}
|
||||
article_attributes['attachments'].push data
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
attributes['articles'].push article_attributes
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class Token < ActiveRecord::Base
|
|||
def self.check( data )
|
||||
|
||||
# fetch token
|
||||
token = Token.where( action: data[:action], name: data[:name] ).first
|
||||
token = Token.find_by( action: data[:action], name: data[:name] )
|
||||
return if !token
|
||||
|
||||
# check if token is still valid
|
||||
|
|
|
@ -172,6 +172,7 @@ translate strings in ruby context, e. g. for notifications
|
|||
return if target_initial
|
||||
self.target_initial = self.target
|
||||
end
|
||||
|
||||
def cache_clear
|
||||
Cache.delete( 'Translation::' + self.locale.downcase )
|
||||
end
|
||||
|
|
|
@ -184,11 +184,11 @@ returns
|
|||
return if !password || password == ''
|
||||
|
||||
# try to find user based on login
|
||||
user = User.where( login: username.downcase, active: true ).first
|
||||
user = User.find_by( login: username.downcase, active: true )
|
||||
|
||||
# try second lookup with email
|
||||
if !user
|
||||
user = User.where( email: username.downcase, active: true ).first
|
||||
user = User.find_by( email: username.downcase, active: true )
|
||||
end
|
||||
|
||||
# check failed logins
|
||||
|
@ -280,11 +280,11 @@ returns
|
|||
return if !username || username == ''
|
||||
|
||||
# try to find user based on login
|
||||
user = User.where( login: username.downcase, active: true ).first
|
||||
user = User.find_by( login: username.downcase, active: true )
|
||||
|
||||
# try second lookup with email
|
||||
if !user
|
||||
user = User.where( email: username.downcase, active: true ).first
|
||||
user = User.find_by( email: username.downcase, active: true )
|
||||
end
|
||||
|
||||
# check if email address exists
|
||||
|
@ -377,7 +377,7 @@ returns
|
|||
user.update_attributes( password: password )
|
||||
|
||||
# delete token
|
||||
Token.where( action: 'PasswordReset', name: token ).first.destroy
|
||||
Token.find_by( action: 'PasswordReset', name: token ).destroy
|
||||
user
|
||||
end
|
||||
|
||||
|
@ -476,7 +476,7 @@ returns
|
|||
self.login = self.login.downcase
|
||||
check = true
|
||||
while check
|
||||
exists = User.where( login: self.login ).first
|
||||
exists = User.find_by( login: self.login )
|
||||
if exists && exists.id != self.id
|
||||
self.login = self.login + rand(999).to_s
|
||||
else
|
||||
|
|
|
@ -3,6 +3,7 @@ class UpdateSession < ActiveRecord::Migration
|
|||
add_column :sessions, :request_type, :integer, null: true
|
||||
add_index :sessions, :request_type
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,6 +28,7 @@ class UpdateTicketNumber < ActiveRecord::Migration
|
|||
frontend: false
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,6 +47,7 @@ class UpdateAuth < ActiveRecord::Migration
|
|||
frontend: false
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,6 +53,7 @@ class AddSearchIndex < ActiveRecord::Migration
|
|||
User.search_index_reload
|
||||
Organization.search_index_reload
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class RenameAvatarTypo < ActiveRecord::Migration
|
|||
def up
|
||||
rename_column :avatars, :inital, :initial
|
||||
end
|
||||
|
||||
def down
|
||||
rename_column :avatars, :initial, :inital
|
||||
end
|
||||
|
|
|
@ -45,8 +45,8 @@ returns
|
|||
|
||||
user_auth = backend.check( username, password, config_item, user )
|
||||
|
||||
# auth ok
|
||||
if user_auth
|
||||
# auth not ok
|
||||
next if !user_auth
|
||||
|
||||
Rails.logger.info "Authentication against #{config_item[:adapter]} for user #{user_auth.login} ok."
|
||||
|
||||
|
@ -54,7 +54,6 @@ returns
|
|||
user_auth.update_last_login
|
||||
|
||||
return user_auth
|
||||
end
|
||||
}
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Auth::Developer
|
||||
def self.check( username, password, config, user )
|
||||
def self.check( _username, password, _config, user )
|
||||
|
||||
# development systems
|
||||
if Setting.get('developer_mode') == true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Auth::Internal
|
||||
def self.check( username, password, config, user )
|
||||
def self.check( _username, password, _config, user )
|
||||
|
||||
# return if no user exists
|
||||
return nil if !user
|
||||
|
|
|
@ -46,7 +46,7 @@ module Auth::Ldap
|
|||
end
|
||||
end
|
||||
|
||||
if user_dn == nil
|
||||
if user_dn.nil?
|
||||
Rails.logger.info "ldap entry found for user '#{username}' with filter #{filter} failed!"
|
||||
return nil
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ class Class
|
|||
.tr('-', '_')
|
||||
.downcase
|
||||
end
|
||||
|
||||
def to_app_model
|
||||
camel_cased_word = self.to_s
|
||||
camel_cased_word.gsub(/::/, '').to_sym
|
||||
|
|
|
@ -7,6 +7,7 @@ class String
|
|||
end
|
||||
body_quote
|
||||
end
|
||||
|
||||
def word_wrap(*args)
|
||||
options = args.extract_options!
|
||||
unless args.blank?
|
||||
|
@ -66,13 +67,13 @@ class String
|
|||
# see also test/fixtures/mail21.box
|
||||
# note: string.encode!('UTF-8', 'UTF-8', :invalid => :replace, :replace => '?') was not detecting invalid chars
|
||||
if !string.valid_encoding?
|
||||
string = string.chars.select { |c| c.valid_encoding? }.join
|
||||
string = string.chars.select(&:valid_encoding?).join
|
||||
end
|
||||
|
||||
# find <a href=....> and replace it with [x]
|
||||
link_list = ''
|
||||
counter = 0
|
||||
string.gsub!( /<a\s.*?href=("|')(.+?)("|').*?>/ix ) { |item|
|
||||
string.gsub!( /<a\s.*?href=("|')(.+?)("|').*?>/ix ) {
|
||||
link = $2
|
||||
counter = counter + 1
|
||||
link_list += "[#{counter}] #{link}\n"
|
||||
|
@ -121,12 +122,12 @@ class String
|
|||
string.gsub!( ' ', ' ' )
|
||||
|
||||
# encode html entities like "–"
|
||||
string.gsub!( /(&\#(\d+);?)/x ) { |item|
|
||||
string.gsub!( /(&\#(\d+);?)/x ) {
|
||||
$2.chr
|
||||
}
|
||||
|
||||
# encode html entities like "d;"
|
||||
string.gsub!( /(&\#[xX]([0-9a-fA-F]+);?)/x ) { |item|
|
||||
string.gsub!( /(&\#[xX]([0-9a-fA-F]+);?)/x ) {
|
||||
chr_orig = $1
|
||||
hex = $2.hex
|
||||
if hex
|
||||
|
|
|
@ -14,7 +14,7 @@ module FillDB
|
|||
# organizations
|
||||
organization_pool = []
|
||||
if organizations && !organizations.zero?
|
||||
(1..organizations).each {|count|
|
||||
(1..organizations).each {
|
||||
organization = Organization.create( name: 'FillOrganization::' + rand(999_999).to_s, active: true )
|
||||
organization_pool.push organization
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ module FillDB
|
|||
if agents && !agents.zero?
|
||||
roles = Role.where( name: [ 'Agent'] )
|
||||
groups_all = Group.all
|
||||
(1..agents).each {|count|
|
||||
(1..agents).each {
|
||||
suffix = rand(99_999).to_s
|
||||
user = User.create_or_update(
|
||||
login: "filldb-agent-#{suffix}",
|
||||
|
@ -51,7 +51,7 @@ module FillDB
|
|||
if customers && !customers.zero?
|
||||
roles = Role.where( name: [ 'Customer'] )
|
||||
groups_all = Group.all
|
||||
(1..customers).each {|count|
|
||||
(1..customers).each {
|
||||
suffix = rand(99_999).to_s
|
||||
organization = nil
|
||||
if !organization_pool.empty? && rand(2) == 1
|
||||
|
@ -77,7 +77,7 @@ module FillDB
|
|||
group_pool = []
|
||||
if groups && !groups.zero?
|
||||
puts "1..#{groups}"
|
||||
(1..groups).each {|count|
|
||||
(1..groups).each {
|
||||
group = Group.create( name: 'FillGroup::' + rand(999_999).to_s, active: true )
|
||||
group_pool.push group
|
||||
Role.where(name: 'Agent').first.users.where(active: true).each {|user|
|
||||
|
@ -95,7 +95,7 @@ module FillDB
|
|||
priority_pool = Ticket::Priority.all
|
||||
state_pool = Ticket::State.all
|
||||
if tickets && !tickets.zero?
|
||||
(1..tickets).each {|count|
|
||||
(1..tickets).each {
|
||||
customer = customer_pool[ rand(customer_pool.length - 1) ]
|
||||
agent = agent_pool[ rand(agent_pool.length - 1) ]
|
||||
ticket = Ticket.create(
|
||||
|
|
|
@ -522,7 +522,10 @@ module Import::OTRS
|
|||
created_by_id: history['CreateBy']
|
||||
)
|
||||
end
|
||||
if history['ArticleID'] && history['ArticleID'] != 0
|
||||
|
||||
next if !history['ArticleID']
|
||||
next if history['ArticleID'] == 0
|
||||
|
||||
History.add(
|
||||
id: history['HistoryID'],
|
||||
o_id: history['ArticleID'],
|
||||
|
@ -533,7 +536,6 @@ module Import::OTRS
|
|||
created_at: history['CreateTime'],
|
||||
created_by_id: history['CreateBy']
|
||||
)
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
|
@ -480,7 +480,7 @@ module Import::OTRS2
|
|||
|
||||
end
|
||||
|
||||
def self._ticket_result(result, locks, thread = '-')
|
||||
def self._ticket_result(result, locks, _thread = '-')
|
||||
# puts result.inspect
|
||||
map = {
|
||||
Ticket: {
|
||||
|
@ -747,7 +747,10 @@ module Import::OTRS2
|
|||
created_by_id: history['CreateBy']
|
||||
)
|
||||
end
|
||||
if history['ArticleID'] && history['ArticleID'] != 0
|
||||
|
||||
next if !history['ArticleID']
|
||||
next if history['ArticleID'] == 0
|
||||
|
||||
History.add(
|
||||
id: history['HistoryID'],
|
||||
o_id: history['ArticleID'],
|
||||
|
@ -758,7 +761,6 @@ module Import::OTRS2
|
|||
created_at: history['CreateTime'],
|
||||
created_by_id: history['CreateBy']
|
||||
)
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
@ -968,17 +970,18 @@ module Import::OTRS2
|
|||
}
|
||||
end
|
||||
|
||||
def self.get_queue_ids(user, groups, roles, queues)
|
||||
def self.get_queue_ids(user, _groups, _roles, queues)
|
||||
queue_ids = []
|
||||
|
||||
# lookup by groups
|
||||
user['GroupIDs'].each {|group_id, permissions|
|
||||
queues.each {|queue_lookup|
|
||||
if queue_lookup['GroupID'] == group_id
|
||||
if permissions && permissions.include?('rw')
|
||||
|
||||
next if queue_lookup['GroupID'] != group_id
|
||||
next if !permissions
|
||||
next if !permissions.include?('rw')
|
||||
|
||||
queue_ids.push queue_lookup['QueueID']
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -991,19 +994,23 @@ module Import::OTRS2
|
|||
queue_ids
|
||||
end
|
||||
|
||||
def self.get_roles_ids(user, groups, roles, queues)
|
||||
def self.get_roles_ids(user, groups, roles, _queues)
|
||||
roles = ['Agent']
|
||||
role_ids = []
|
||||
user['GroupIDs'].each {|group_id, permissions|
|
||||
groups.each {|group_lookup|
|
||||
if group_id == group_lookup['ID']
|
||||
if group_lookup['Name'] == 'admin' && permissions && permissions.include?('rw')
|
||||
|
||||
next if group_id != group_lookup['ID']
|
||||
next if permissions
|
||||
|
||||
if group_lookup['Name'] == 'admin' && permissions.include?('rw')
|
||||
roles.push 'Admin'
|
||||
end
|
||||
if group_lookup['Name'] =~ /^(stats|report)/ && permissions && ( permissions.include?('ro') || permissions.include?('rw') )
|
||||
|
||||
next if group_lookup['Name'] !~ /^(stats|report)/
|
||||
next if !( permissions.include?('ro') || permissions.include?('rw') )
|
||||
|
||||
roles.push 'Report'
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
roles.each {|role|
|
||||
|
|
|
@ -63,11 +63,12 @@ module NotificationFactory
|
|||
object_refs = object_refs.send( method.to_sym )
|
||||
|
||||
# add body quote
|
||||
if object_name == 'article' && method == 'body'
|
||||
if data[:objects][:article].content_type == 'text/html'
|
||||
next if object_name != 'article'
|
||||
next if method != 'body'
|
||||
|
||||
next if data[:objects][:article].content_type != 'text/html'
|
||||
|
||||
object_refs = object_refs.html2text.chomp
|
||||
end
|
||||
end
|
||||
}
|
||||
if !value
|
||||
placeholder = object_refs
|
||||
|
@ -80,10 +81,11 @@ module NotificationFactory
|
|||
}
|
||||
|
||||
# translate
|
||||
data[:string].gsub!( /i18n\((|.+?)\)/ ) { |placeholder|
|
||||
data[:string].gsub!( /i18n\((|.+?)\)/ ) {
|
||||
string = $1
|
||||
locale = data[:locale] || 'en'
|
||||
placeholder = Translation.translate( locale, string )
|
||||
|
||||
Translation.translate( locale, string )
|
||||
}
|
||||
|
||||
data[:string]
|
||||
|
|
|
@ -150,7 +150,7 @@ return search result
|
|||
|
||||
=end
|
||||
|
||||
def self.search( query, limit = 10, index = nil, query_extention = {} )
|
||||
def self.search( query, _limit = 10, index = nil, query_extention = {} )
|
||||
return [] if !query
|
||||
|
||||
url = build_url()
|
||||
|
|
|
@ -470,14 +470,16 @@ returns
|
|||
|
||||
# spool to recipient list
|
||||
if message_parsed['recipient'] && message_parsed['recipient']['user_id']
|
||||
|
||||
message_parsed['recipient']['user_id'].each { |user_id|
|
||||
if current_user_id == user_id
|
||||
|
||||
next if current_user_id != user_id
|
||||
|
||||
item = {
|
||||
type: 'direct',
|
||||
message: message_parsed,
|
||||
}
|
||||
data.push item
|
||||
end
|
||||
}
|
||||
|
||||
# spool to every client
|
||||
|
@ -521,7 +523,8 @@ returns
|
|||
next if !user
|
||||
|
||||
# start client thread
|
||||
if !@@client_threads[client_id]
|
||||
next if @@client_threads[client_id]
|
||||
|
||||
@@client_threads[client_id] = true
|
||||
@@client_threads[client_id] = Thread.new {
|
||||
thread_client(client_id)
|
||||
|
@ -530,7 +533,6 @@ returns
|
|||
ActiveRecord::Base.connection.close
|
||||
}
|
||||
sleep 0.5
|
||||
end
|
||||
}
|
||||
|
||||
# system settings
|
||||
|
|
|
@ -36,8 +36,8 @@ class Sessions::Client
|
|||
user_id_last_run = user.id
|
||||
|
||||
# release old objects
|
||||
backend_pool.each {|pool|
|
||||
pool = nil
|
||||
backend_pool.collect! {
|
||||
nil
|
||||
}
|
||||
|
||||
# create new pool
|
||||
|
@ -52,9 +52,7 @@ class Sessions::Client
|
|||
self.log "---client - looking for data of user #{user.id}"
|
||||
|
||||
# push messages from backends
|
||||
backend_pool.each {|pool|
|
||||
pool.push
|
||||
}
|
||||
backend_pool.each(&:push)
|
||||
|
||||
self.log '---/client-'
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ returns
|
|||
|
||||
user_auth = backend.check( params, config_item )
|
||||
|
||||
# auth ok
|
||||
if user_auth
|
||||
# auth not ok
|
||||
next if !user_auth
|
||||
|
||||
Rails.logger.info "Authentication against #{config_item[:adapter]} for user #{user.login} ok."
|
||||
|
||||
|
@ -65,7 +65,6 @@ returns
|
|||
user_auth.update_last_login
|
||||
|
||||
return user_auth
|
||||
end
|
||||
}
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Sso::Env
|
||||
def self.check( params, config_item )
|
||||
def self.check( _params, _config_item )
|
||||
|
||||
# try to find user based on login
|
||||
if ENV['REMOTE_USER']
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Sso::Otrs
|
||||
def self.check( params, config_item )
|
||||
def self.check( params, _config_item )
|
||||
|
||||
endpoint = Setting.get('import_otrs_endpoint')
|
||||
return false if !endpoint
|
||||
|
|
|
@ -2,7 +2,7 @@ $LOAD_PATH << './lib'
|
|||
require 'rubygems'
|
||||
|
||||
namespace :searchindex do
|
||||
task :drop, [:opts] => :environment do |t, args|
|
||||
task :drop, [:opts] => :environment do |_t, _args|
|
||||
|
||||
# drop indexes
|
||||
puts 'drop indexes...'
|
||||
|
@ -12,7 +12,7 @@ namespace :searchindex do
|
|||
|
||||
end
|
||||
|
||||
task :create, [:opts] => :environment do |t, args|
|
||||
task :create, [:opts] => :environment do |_t, _args|
|
||||
|
||||
# create indexes
|
||||
puts 'create indexes...'
|
||||
|
@ -39,7 +39,7 @@ namespace :searchindex do
|
|||
|
||||
end
|
||||
|
||||
task :reload, [:opts] => :environment do |t, args|
|
||||
task :reload, [:opts] => :environment do |_t, _args|
|
||||
|
||||
puts 'reload data...'
|
||||
User.search_index_reload
|
||||
|
@ -48,7 +48,7 @@ namespace :searchindex do
|
|||
|
||||
end
|
||||
|
||||
task :rebuild, [:opts] => :environment do |t, args|
|
||||
task :rebuild, [:opts] => :environment do |_t, _args|
|
||||
|
||||
Rake::Task['searchindex:drop'].execute
|
||||
Rake::Task['searchindex:create'].execute
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rubygems'
|
|||
|
||||
namespace :test do
|
||||
desc 'Start browser tests'
|
||||
task :browser, [:opts] => :environment do |t, args|
|
||||
task :browser, [:opts] => :environment do |_t, args|
|
||||
|
||||
start = Time.now()
|
||||
if !args.opts
|
||||
|
|
|
@ -35,7 +35,12 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|||
working_hours = {}
|
||||
[:Mon, :Tue, :Wed, :Thu, :Fri, :Sat, :Sun].each {|day|
|
||||
working_hours[day] = []
|
||||
if config[day.to_s] == true || config[day.to_s] == day.to_s
|
||||
|
||||
next if !config[day.to_s]
|
||||
if config[day.to_s] != true && config[day.to_s] != day.to_s
|
||||
next
|
||||
end
|
||||
|
||||
config_ok = true
|
||||
(0..23).each {|hour|
|
||||
time = Time.parse("1977-10-27 #{hour}:00:00")
|
||||
|
@ -45,7 +50,6 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|||
working_hours[day].push nil
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
if !config_ok
|
||||
|
@ -65,9 +69,11 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|||
Sat: [],
|
||||
Sun: [],
|
||||
}
|
||||
(1..hours_to_shift).each {|count|
|
||||
(1..hours_to_shift).each {
|
||||
working_hours.each {|day, value|
|
||||
if working_hours[day]
|
||||
|
||||
next if !value
|
||||
|
||||
to_move = working_hours[day].shift
|
||||
if day == :Mon
|
||||
move_items[:Tue].push to_move
|
||||
|
@ -84,7 +90,6 @@ put working hours matrix and timezone in function, returns UTC working hours mat
|
|||
elsif day == :Sun
|
||||
move_items[:Mon].push to_move
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
move_items.each {|day, value|
|
||||
|
|
|
@ -198,14 +198,15 @@ EventMachine.run {
|
|||
log 'error', "recipient.user_id attribute isn't an array '#{ data['recipient']['user_id'].inspect }'"
|
||||
else
|
||||
data['recipient']['user_id'].each { |user_id|
|
||||
if local_client[:user]['id'].to_i == user_id.to_i
|
||||
|
||||
next if local_client[:user]['id'].to_i != user_id.to_i
|
||||
|
||||
log 'notice', "send broadcast from (#{client_id}) to (user_id=#{user_id})", local_client_id
|
||||
if local_client[:meta][:type] == 'websocket' && @clients[ local_client_id ]
|
||||
@clients[ local_client_id ][:websocket].send( "[#{msg}]" )
|
||||
else
|
||||
Sessions.send( local_client_id, data )
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -242,14 +243,14 @@ EventMachine.run {
|
|||
|
||||
# websocket
|
||||
log 'notice', "Status: websocket clients: #{ @clients.size }"
|
||||
@clients.each { |client_id, client|
|
||||
@clients.each { |client_id, _client|
|
||||
log 'notice', 'working...', client_id
|
||||
}
|
||||
|
||||
# ajax
|
||||
client_list = Sessions.list
|
||||
clients = 0
|
||||
client_list.each {|client_id, client|
|
||||
client_list.each {|_client_id, client|
|
||||
next if client[:meta][:type] == 'websocket'
|
||||
clients = clients + 1
|
||||
}
|
||||
|
@ -296,7 +297,9 @@ EventMachine.run {
|
|||
|
||||
# close unused web socket sessions
|
||||
@clients.each { |client_id, client|
|
||||
if ( client[:last_ping] + idle_time_in_sec ) < Time.now
|
||||
|
||||
next if ( client[:last_ping] + idle_time_in_sec ) >= Time.now
|
||||
|
||||
log 'notice', 'closing idle websocket connection', client_id
|
||||
|
||||
# remember to not use this connection anymore
|
||||
|
@ -308,7 +311,6 @@ EventMachine.run {
|
|||
# delete session from client list
|
||||
sleep 0.3
|
||||
@clients.delete(client_id)
|
||||
end
|
||||
}
|
||||
|
||||
# close unused ajax long polling sessions
|
||||
|
|
|
@ -11,6 +11,7 @@ class AAbUnitTest < TestCase
|
|||
value: '0',
|
||||
)
|
||||
end
|
||||
|
||||
def test_ui
|
||||
@browser = browser_instance
|
||||
location( url: browser_url + '/tests-ui' )
|
||||
|
@ -34,6 +35,7 @@ class AAbUnitTest < TestCase
|
|||
value: '0',
|
||||
)
|
||||
end
|
||||
|
||||
def test_form
|
||||
@browser = browser_instance
|
||||
location( url: browser_url + '/tests-form' )
|
||||
|
@ -57,6 +59,7 @@ class AAbUnitTest < TestCase
|
|||
value: '0',
|
||||
)
|
||||
end
|
||||
|
||||
def test_table
|
||||
@browser = browser_instance
|
||||
location( url: browser_url + '/tests-table' )
|
||||
|
|
|
@ -20,6 +20,7 @@ class TaskbarTaskTest < TestCase
|
|||
)
|
||||
sleep 10
|
||||
end
|
||||
|
||||
def test_persistant_task_b
|
||||
@browser = browser_instance
|
||||
login(
|
||||
|
@ -41,6 +42,7 @@ class TaskbarTaskTest < TestCase
|
|||
|
||||
exists_not( css: '.active .newTicket input[name="title"]' )
|
||||
end
|
||||
|
||||
def test_persistant_task_with_relogin
|
||||
@browser = browser_instance
|
||||
login(
|
||||
|
|
|
@ -68,7 +68,7 @@ class TestCase < Test::Unit::TestCase
|
|||
|
||||
def teardown
|
||||
return if !@browsers
|
||||
@browsers.each { |hash, local_browser|
|
||||
@browsers.each { |_hash, local_browser|
|
||||
screenshot( browser: local_browser, comment: 'teardown' )
|
||||
browser_instance_close(local_browser)
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class TestCase < Test::Unit::TestCase
|
|||
instance.find_elements( { css: 'a[href="#current_user"]' } )[0].click
|
||||
sleep 0.1
|
||||
instance.find_elements( { css: 'a[href="#logout"]' } )[0].click
|
||||
(1..6).each {|loop|
|
||||
(1..6).each {
|
||||
sleep 1
|
||||
login = instance.find_elements( { css: '#login' } )[0]
|
||||
if login
|
||||
|
@ -696,7 +696,7 @@ class TestCase < Test::Unit::TestCase
|
|||
|
||||
=end
|
||||
|
||||
def open_task(params = {}, fallback = false)
|
||||
def open_task(params = {}, _fallback = false)
|
||||
log('open_task', params)
|
||||
|
||||
instance = params[:browser] || @browser
|
||||
|
@ -760,7 +760,7 @@ class TestCase < Test::Unit::TestCase
|
|||
end
|
||||
loops = (timeout).to_i * 2
|
||||
text = ''
|
||||
(1..loops).each { |loop|
|
||||
(1..loops).each {
|
||||
element = instance.find_elements( { css: params[:css] } )[0]
|
||||
if element #&& element.displayed?
|
||||
begin
|
||||
|
@ -820,7 +820,7 @@ wait untill text in selector disabppears
|
|||
end
|
||||
loops = (timeout).to_i
|
||||
text = ''
|
||||
(1..loops).each { |loop|
|
||||
(1..loops).each {
|
||||
element = instance.find_elements( { css: params[:css] } )[0]
|
||||
if !element #|| element.displayed?
|
||||
assert( true, 'not found' )
|
||||
|
@ -942,7 +942,7 @@ wait untill text in selector disabppears
|
|||
end
|
||||
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
(1..12).each {|loop|
|
||||
(1..12).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
|
@ -1063,7 +1063,7 @@ wait untill text in selector disabppears
|
|||
#instance.execute_script( '$(".content.active .newTicket form").submit();' )
|
||||
instance.find_elements( { css: '.active .newTicket button.submit' } )[0].click
|
||||
sleep 1
|
||||
(1..10).each {|loop|
|
||||
(1..10).each {
|
||||
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
|
||||
assert( true, 'ticket created' )
|
||||
sleep 2.5
|
||||
|
@ -1220,7 +1220,7 @@ wait untill text in selector disabppears
|
|||
|
||||
if data[:state] || data[:group] || data[:body]
|
||||
found = nil
|
||||
(1..5).each {|loop|
|
||||
(1..5).each {
|
||||
if !found
|
||||
begin
|
||||
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
||||
|
@ -1246,7 +1246,7 @@ wait untill text in selector disabppears
|
|||
|
||||
instance.find_elements( { css: '.content.active button.js-submit' } )[0].click
|
||||
|
||||
(1..10).each {|loop|
|
||||
(1..10).each {
|
||||
begin
|
||||
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
||||
if !text || text.empty?
|
||||
|
@ -1408,7 +1408,7 @@ wait untill text in selector disabppears
|
|||
#puts url.inspect
|
||||
#puts element.inspect
|
||||
}
|
||||
overviews.each {|url, value|
|
||||
overviews.each {|url, _value|
|
||||
count = instance.find_elements( { css: ".content.active .sidebar a[href=\"#{url}\"] .badge" } )[0].text
|
||||
overviews[url] = count.to_i
|
||||
}
|
||||
|
@ -1576,7 +1576,7 @@ wait untill text in selector disabppears
|
|||
element.clear
|
||||
element.send_keys( data[:first_response_time] )
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
(1..8).each {|loop|
|
||||
(1..8).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
|
@ -1623,7 +1623,7 @@ wait untill text in selector disabppears
|
|||
element.clear
|
||||
element.send_keys( data[:content] )
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
(1..8).each {|loop|
|
||||
(1..8).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
|
@ -1667,7 +1667,7 @@ wait untill text in selector disabppears
|
|||
element.clear
|
||||
element.send_keys( data[:body] )
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
(1..12).each {|loop|
|
||||
(1..12).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
|
@ -1719,7 +1719,7 @@ wait untill text in selector disabppears
|
|||
dropdown.select_by( :text, data[:signature])
|
||||
end
|
||||
instance.find_elements( { css: '.modal button.js-submit' } )[0].click
|
||||
(1..12).each {|loop|
|
||||
(1..12).each {
|
||||
element = instance.find_elements( { css: 'body' } )[0]
|
||||
text = element.text
|
||||
if text =~ /#{Regexp.quote(data[:name])}/
|
||||
|
|
|
@ -30,9 +30,7 @@ class TwitterTest < ActiveSupport::TestCase
|
|||
|
||||
# add channel
|
||||
current = Channel.where( adapter: 'Twitter2' )
|
||||
current.each {|r|
|
||||
r.destroy
|
||||
}
|
||||
current.each(&:destroy)
|
||||
Channel.create(
|
||||
adapter: 'Twitter2',
|
||||
area: 'Twitter::Inbound',
|
||||
|
@ -165,7 +163,7 @@ class TwitterTest < ActiveSupport::TestCase
|
|||
|
||||
# fetch check system account
|
||||
article = nil
|
||||
(1..4).each {|loop|
|
||||
(1..4).each {
|
||||
next if article
|
||||
sleep 25
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class ActiveSupport::TestCase
|
|||
return if Delayed::Job.all.empty?
|
||||
|
||||
Delayed::Job.where('failed_at != NULL').each {|job|
|
||||
assert( false, "not processable job #{jobs.inspect}" )
|
||||
assert( false, "not processable job #{job.inspect}" )
|
||||
}
|
||||
Delayed::Job.all.destroy_all
|
||||
end
|
||||
|
|
|
@ -300,7 +300,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
|
|||
if message['event'] == 'resetCollection'
|
||||
#puts "rc: "
|
||||
if message['data']
|
||||
message['data'].each {|key, value|
|
||||
message['data'].each {|key, _value|
|
||||
#puts "rc: #{key}"
|
||||
collections_result[key] = true
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
|
|||
end
|
||||
}
|
||||
#puts "c: #{collections_result.inspect}"
|
||||
collections_orig.each {|key, value|
|
||||
collections_orig.each {|key, _value|
|
||||
assert_equal( collections_orig[key], collections_result[key], "collection message for #{key} #{type}-check (client_id #{client_id})" )
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue