Updated rubocop(-* gems) to latest version (1.2.0).
This commit is contained in:
parent
0655b370ed
commit
43b6374d16
29 changed files with 112 additions and 120 deletions
2
Gemfile
2
Gemfile
|
@ -185,7 +185,7 @@ group :development, :test do
|
||||||
gem 'rubocop'
|
gem 'rubocop'
|
||||||
gem 'rubocop-performance'
|
gem 'rubocop-performance'
|
||||||
gem 'rubocop-rails'
|
gem 'rubocop-rails'
|
||||||
gem 'rubocop-rspec'
|
gem 'rubocop-rspec', '2.0.0.pre' # see: https://github.com/rubocop-hq/rubocop-rspec/issues/1051
|
||||||
|
|
||||||
# changelog generation
|
# changelog generation
|
||||||
gem 'github_changelog_generator'
|
gem 'github_changelog_generator'
|
||||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -452,16 +452,16 @@ GEM
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-support (3.9.3)
|
rspec-support (3.9.3)
|
||||||
rszr (0.5.2)
|
rszr (0.5.2)
|
||||||
rubocop (0.93.1)
|
rubocop (1.2.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 2.7.1.5)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8)
|
regexp_parser (>= 1.8)
|
||||||
rexml
|
rexml
|
||||||
rubocop-ast (>= 0.6.0)
|
rubocop-ast (>= 1.0.1)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 2.0)
|
unicode-display_width (>= 1.4.0, < 2.0)
|
||||||
rubocop-ast (1.0.0)
|
rubocop-ast (1.1.1)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 2.7.1.5)
|
||||||
rubocop-performance (1.8.1)
|
rubocop-performance (1.8.1)
|
||||||
rubocop (>= 0.87.0)
|
rubocop (>= 0.87.0)
|
||||||
|
@ -470,9 +470,8 @@ GEM
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.87.0)
|
rubocop (>= 0.87.0)
|
||||||
rubocop-rspec (1.44.1)
|
rubocop-rspec (2.0.0.pre)
|
||||||
rubocop (~> 0.87)
|
rubocop (~> 1.0)
|
||||||
rubocop-ast (>= 0.7.1)
|
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
ruby-saml (1.10.2)
|
ruby-saml (1.10.2)
|
||||||
nokogiri (>= 1.5.10)
|
nokogiri (>= 1.5.10)
|
||||||
|
@ -656,7 +655,7 @@ DEPENDENCIES
|
||||||
rubocop
|
rubocop
|
||||||
rubocop-performance
|
rubocop-performance
|
||||||
rubocop-rails
|
rubocop-rails
|
||||||
rubocop-rspec
|
rubocop-rspec (= 2.0.0.pre)
|
||||||
rubyntlm!
|
rubyntlm!
|
||||||
sassc-rails
|
sassc-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
|
|
|
@ -16,10 +16,10 @@ class SearchController < ApplicationController
|
||||||
|
|
||||||
# convert objects string into array of class names
|
# convert objects string into array of class names
|
||||||
# e.g. user-ticket-another_object = %w( User Ticket AnotherObject )
|
# e.g. user-ticket-another_object = %w( User Ticket AnotherObject )
|
||||||
objects = if !params[:objects]
|
objects = if params[:objects]
|
||||||
Setting.get('models_searchable')
|
|
||||||
else
|
|
||||||
params[:objects].split('-').map(&:camelize)
|
params[:objects].split('-').map(&:camelize)
|
||||||
|
else
|
||||||
|
Setting.get('models_searchable')
|
||||||
end
|
end
|
||||||
|
|
||||||
# get priorities of result
|
# get priorities of result
|
||||||
|
|
|
@ -329,10 +329,10 @@ example
|
||||||
|
|
||||||
begin
|
begin
|
||||||
timeout(FETCH_MSG_TIMEOUT) do
|
timeout(FETCH_MSG_TIMEOUT) do
|
||||||
if !keep_on_server
|
if keep_on_server
|
||||||
@imap.store(message_id, '+FLAGS', [:Deleted])
|
|
||||||
else
|
|
||||||
@imap.store(message_id, '+FLAGS', [:Seen])
|
@imap.store(message_id, '+FLAGS', [:Seen])
|
||||||
|
else
|
||||||
|
@imap.store(message_id, '+FLAGS', [:Deleted])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Timeout::Error => e
|
rescue Timeout::Error => e
|
||||||
|
|
|
@ -943,12 +943,11 @@ module Mail
|
||||||
# https://github.com/zammad/zammad/issues/348
|
# https://github.com/zammad/zammad/issues/348
|
||||||
class Body
|
class Body
|
||||||
def decoded
|
def decoded
|
||||||
if !Encodings.defined?(encoding)
|
if Encodings.defined?(encoding)
|
||||||
#raise UnknownEncodingType, "Don't know how to decode #{encoding}, please call #encoded and decode it yourself."
|
Encodings.get_encoding(encoding).decode(raw_source)
|
||||||
|
else
|
||||||
Rails.logger.info "UnknownEncodingType: Don't know how to decode #{encoding}!"
|
Rails.logger.info "UnknownEncodingType: Don't know how to decode #{encoding}!"
|
||||||
raw_source
|
raw_source
|
||||||
else
|
|
||||||
Encodings.get_encoding(encoding).decode(raw_source)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -226,7 +226,7 @@ returns
|
||||||
# see specs for example
|
# see specs for example
|
||||||
return [] if !text.is_a?(String)
|
return [] if !text.is_a?(String)
|
||||||
|
|
||||||
text.scan(/([\d|\s|\-|(|)]{6,26})/).map do |match|
|
text.scan(/([\d\s\-(|)]{6,26})/).map do |match|
|
||||||
normalize_number(match[0])
|
normalize_number(match[0])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -155,16 +155,16 @@ class Observer::Transaction < ActiveRecord::Observer
|
||||||
|
|
||||||
# merge changes
|
# merge changes
|
||||||
if event[:changes]
|
if event[:changes]
|
||||||
if !store[:changes]
|
if store[:changes]
|
||||||
store[:changes] = event[:changes]
|
|
||||||
else
|
|
||||||
event[:changes].each do |key, value|
|
event[:changes].each do |key, value|
|
||||||
if !store[:changes][key]
|
if store[:changes][key]
|
||||||
store[:changes][key] = value
|
|
||||||
else
|
|
||||||
store[:changes][key][1] = value[1]
|
store[:changes][key][1] = value[1]
|
||||||
|
else
|
||||||
|
store[:changes][key] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
store[:changes] = event[:changes]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,15 +73,14 @@ class SMIMECertificate < ApplicationModel
|
||||||
@email_addresses ||= begin
|
@email_addresses ||= begin
|
||||||
subject_alt_name = parsed.extensions.detect { |extension| extension.oid == 'subjectAltName' }
|
subject_alt_name = parsed.extensions.detect { |extension| extension.oid == 'subjectAltName' }
|
||||||
if subject_alt_name.blank?
|
if subject_alt_name.blank?
|
||||||
warning = <<~TEXT.squish
|
Rails.logger.warn <<~TEXT.squish
|
||||||
SMIMECertificate with ID #{id} has no subjectAltName
|
SMIMECertificate with ID #{id} has no subjectAltName
|
||||||
extension and therefore no email addresses assigned.
|
extension and therefore no email addresses assigned.
|
||||||
This makes it useless in terms of S/MIME. Please check.
|
This makes it useless in terms of S/MIME. Please check.
|
||||||
TEXT
|
TEXT
|
||||||
Rails.logger.warn warning
|
|
||||||
return []
|
|
||||||
end
|
|
||||||
|
|
||||||
|
[]
|
||||||
|
else
|
||||||
# ["IP Address:192.168.7.23", "IP Address:192.168.7.42", "email:jd@example.com", "email:John.Doe@example.com", "dirName:dir_sect"]
|
# ["IP Address:192.168.7.23", "IP Address:192.168.7.42", "email:jd@example.com", "email:John.Doe@example.com", "dirName:dir_sect"]
|
||||||
entries = subject_alt_name.value.split(/,\s?/)
|
entries = subject_alt_name.value.split(/,\s?/)
|
||||||
# ["email:jd@example.com", "email:John.Doe@example.com"]
|
# ["email:jd@example.com", "email:John.Doe@example.com"]
|
||||||
|
@ -92,6 +91,7 @@ class SMIMECertificate < ApplicationModel
|
||||||
email_address_entries.map!(&:downcase)
|
email_address_entries.map!(&:downcase)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def expired?
|
def expired?
|
||||||
!Time.zone.now.between?(not_before_at, not_after_at)
|
!Time.zone.now.between?(not_before_at, not_after_at)
|
||||||
|
|
|
@ -470,13 +470,13 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
|
||||||
|
|
||||||
private_class_method def self.locals_to_sync(dedicated_locale = nil)
|
private_class_method def self.locals_to_sync(dedicated_locale = nil)
|
||||||
locales_list = []
|
locales_list = []
|
||||||
if !dedicated_locale
|
if dedicated_locale
|
||||||
|
locales_list = [dedicated_locale]
|
||||||
|
else
|
||||||
locales = Locale.to_sync
|
locales = Locale.to_sync
|
||||||
locales.each do |locale|
|
locales.each do |locale|
|
||||||
locales_list.push locale.locale
|
locales_list.push locale.locale
|
||||||
end
|
end
|
||||||
else
|
|
||||||
locales_list = [dedicated_locale]
|
|
||||||
end
|
end
|
||||||
locales_list
|
locales_list
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,10 @@ class SettingAddPlacetel1 < ActiveRecord::Migration[5.1]
|
||||||
frontend: true
|
frontend: true
|
||||||
)
|
)
|
||||||
placetel_config = Setting.find_by(name: 'placetel_config')
|
placetel_config = Setting.find_by(name: 'placetel_config')
|
||||||
if !placetel_config
|
if placetel_config
|
||||||
|
placetel_config.preferences[:cache] = ['placetelGetVoipUsers']
|
||||||
|
placetel_config.save!
|
||||||
|
else
|
||||||
Setting.create!(
|
Setting.create!(
|
||||||
title: 'Placetel config',
|
title: 'Placetel config',
|
||||||
name: 'placetel_config',
|
name: 'placetel_config',
|
||||||
|
@ -48,9 +51,6 @@ class SettingAddPlacetel1 < ActiveRecord::Migration[5.1]
|
||||||
},
|
},
|
||||||
frontend: false,
|
frontend: false,
|
||||||
)
|
)
|
||||||
else
|
|
||||||
placetel_config.preferences[:cache] = ['placetelGetVoipUsers']
|
|
||||||
placetel_config.save!
|
|
||||||
end
|
end
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'PLACETEL Token',
|
title: 'PLACETEL Token',
|
||||||
|
|
|
@ -124,16 +124,7 @@ class String
|
||||||
# find <a href=....> and replace it with [x]
|
# find <a href=....> and replace it with [x]
|
||||||
link_list = ''
|
link_list = ''
|
||||||
counter = 0
|
counter = 0
|
||||||
if !string_only
|
if string_only
|
||||||
if string.scan(/<a[[:space:]]/i).count < 5_000
|
|
||||||
string.gsub!(/<a[[:space:]].*?href=("|')(.+?)("|').*?>/ix) do
|
|
||||||
link = $2
|
|
||||||
counter = counter + 1
|
|
||||||
link_list += "[#{counter}] #{link}\n"
|
|
||||||
"[#{counter}] "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
string.gsub!(%r{<a[[:space:]]+(|\S+[[:space:]]+)href=("|')(.+?)("|')([[:space:]]*|[[:space:]]+[^>]*)>(.+?)<[[:space:]]*/a[[:space:]]*>}mxi) do |_placeholder|
|
string.gsub!(%r{<a[[:space:]]+(|\S+[[:space:]]+)href=("|')(.+?)("|')([[:space:]]*|[[:space:]]+[^>]*)>(.+?)<[[:space:]]*/a[[:space:]]*>}mxi) do |_placeholder|
|
||||||
link = $3
|
link = $3
|
||||||
text = $6
|
text = $6
|
||||||
|
@ -168,6 +159,13 @@ class String
|
||||||
"#{link} (######LINKRAW:#{text}######)"
|
"#{link} (######LINKRAW:#{text}######)"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elsif string.scan(/<a[[:space:]]/i).count < 5_000
|
||||||
|
string.gsub!(/<a[[:space:]].*?href=("|')(.+?)("|').*?>/ix) do
|
||||||
|
link = $2
|
||||||
|
counter = counter + 1
|
||||||
|
link_list += "[#{counter}] #{link}\n"
|
||||||
|
"[#{counter}] "
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# remove style tags with content
|
# remove style tags with content
|
||||||
|
@ -195,7 +193,7 @@ class String
|
||||||
|
|
||||||
# blockquote handling
|
# blockquote handling
|
||||||
string.gsub!(%r{<blockquote(| [^>]*)>(.+?)</blockquote>}m) do
|
string.gsub!(%r{<blockquote(| [^>]*)>(.+?)</blockquote>}m) do
|
||||||
"\n#{$2.html2text(true).gsub(/^(.*)$/, '> \1')}\n" # rubocop:disable Lint/OutOfRangeRegexpRef
|
"\n#{$2.html2text(true).gsub(/^(.*)$/, '> \1')}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
# pre/code handling 2/2
|
# pre/code handling 2/2
|
||||||
|
|
|
@ -241,10 +241,10 @@ result
|
||||||
to = nil
|
to = nil
|
||||||
if post['to'] && post['to']['data']
|
if post['to'] && post['to']['data']
|
||||||
post['to']['data'].each do |to_entry|
|
post['to']['data'].each do |to_entry|
|
||||||
if !to
|
if to
|
||||||
to = ''
|
|
||||||
else
|
|
||||||
to += ', '
|
to += ', '
|
||||||
|
else
|
||||||
|
to = ''
|
||||||
end
|
end
|
||||||
to += to_entry['name']
|
to += to_entry['name']
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,21 +45,24 @@ or if you only want to create 100 tickets
|
||||||
|
|
||||||
# organizations
|
# organizations
|
||||||
organization_pool = []
|
organization_pool = []
|
||||||
if !organizations.zero?
|
if organizations.zero?
|
||||||
|
organization_pool = Organization.where(active: true)
|
||||||
|
puts " take #{organization_pool.length} organizations"
|
||||||
|
else
|
||||||
(1..organizations).each do
|
(1..organizations).each do
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
organization = Organization.create!(name: "FillOrganization::#{rand(999_999)}", active: true)
|
organization = Organization.create!(name: "FillOrganization::#{rand(999_999)}", active: true)
|
||||||
organization_pool.push organization
|
organization_pool.push organization
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
organization_pool = Organization.where(active: true)
|
|
||||||
puts " take #{organization_pool.length} organizations"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# create agents
|
# create agents
|
||||||
agent_pool = []
|
agent_pool = []
|
||||||
if !agents.zero?
|
if agents.zero?
|
||||||
|
agent_pool = Role.where(name: 'Agent').first.users.where(active: true)
|
||||||
|
puts " take #{agent_pool.length} agents"
|
||||||
|
else
|
||||||
roles = Role.where(name: [ 'Agent'])
|
roles = Role.where(name: [ 'Agent'])
|
||||||
groups_all = Group.all
|
groups_all = Group.all
|
||||||
|
|
||||||
|
@ -80,14 +83,14 @@ or if you only want to create 100 tickets
|
||||||
agent_pool.push user
|
agent_pool.push user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
agent_pool = Role.where(name: 'Agent').first.users.where(active: true)
|
|
||||||
puts " take #{agent_pool.length} agents"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# create customer
|
# create customer
|
||||||
customer_pool = []
|
customer_pool = []
|
||||||
if !customers.zero?
|
if customers.zero?
|
||||||
|
customer_pool = Role.where(name: 'Customer').first.users.where(active: true)
|
||||||
|
puts " take #{customer_pool.length} customers"
|
||||||
|
else
|
||||||
roles = Role.where(name: [ 'Customer'])
|
roles = Role.where(name: [ 'Customer'])
|
||||||
groups_all = Group.all
|
groups_all = Group.all
|
||||||
|
|
||||||
|
@ -112,15 +115,15 @@ or if you only want to create 100 tickets
|
||||||
customer_pool.push user
|
customer_pool.push user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
customer_pool = Role.where(name: 'Customer').first.users.where(active: true)
|
|
||||||
puts " take #{customer_pool.length} customers"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
group_pool = []
|
group_pool = []
|
||||||
if !groups.zero?
|
if groups.zero?
|
||||||
|
|
||||||
|
group_pool = Group.where(active: true)
|
||||||
|
puts " take #{group_pool.length} groups"
|
||||||
|
else
|
||||||
(1..groups).each do
|
(1..groups).each do
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
group = Group.create!(name: "FillGroup::#{rand(999_999)}", active: true)
|
group = Group.create!(name: "FillGroup::#{rand(999_999)}", active: true)
|
||||||
|
@ -134,9 +137,6 @@ or if you only want to create 100 tickets
|
||||||
sleep nice
|
sleep nice
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
group_pool = Group.where(active: true)
|
|
||||||
puts " take #{group_pool.length} groups"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# create overviews
|
# create overviews
|
||||||
|
|
|
@ -113,10 +113,10 @@ satinize html string based on whiltelist
|
||||||
end
|
end
|
||||||
class_new += local_class
|
class_new += local_class
|
||||||
end
|
end
|
||||||
if class_new != ''
|
if class_new == ''
|
||||||
node['class'] = class_new
|
|
||||||
else
|
|
||||||
node.delete('class')
|
node.delete('class')
|
||||||
|
else
|
||||||
|
node['class'] = class_new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -139,11 +139,7 @@ examples how to use
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
placeholder = if !value
|
placeholder = value || object_refs
|
||||||
object_refs
|
|
||||||
else
|
|
||||||
value
|
|
||||||
end
|
|
||||||
|
|
||||||
escaping(convert_to_timezone(placeholder), escape)
|
escaping(convert_to_timezone(placeholder), escape)
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ examples how to use
|
||||||
@template.gsub(/\#{\s*(.*?)\s*}/m) do
|
@template.gsub(/\#{\s*(.*?)\s*}/m) do
|
||||||
# some browsers start adding HTML tags
|
# some browsers start adding HTML tags
|
||||||
# fixes https://github.com/zammad/zammad/issues/385
|
# fixes https://github.com/zammad/zammad/issues/385
|
||||||
input_template = $1.gsub(/\A<.+?>\s*|\s*<.+?>\z/, '') # rubocop:disable Lint/OutOfRangeRegexpRef
|
input_template = $1.gsub(/\A<.+?>\s*|\s*<.+?>\z/, '')
|
||||||
|
|
||||||
case input_template
|
case input_template
|
||||||
when /\At\('(.+?)'\)\z/m
|
when /\At\('(.+?)'\)\z/m
|
||||||
|
|
|
@ -160,13 +160,7 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base
|
||||||
|
|
||||||
data[:assets] = assets.to_h
|
data[:assets] = assets.to_h
|
||||||
|
|
||||||
if !@client
|
if @client
|
||||||
result = {
|
|
||||||
event: 'ticket_overview_list',
|
|
||||||
data: data,
|
|
||||||
}
|
|
||||||
results.push result
|
|
||||||
else
|
|
||||||
@client.log "push overview_list #{overview.link} for user #{@user.id}"
|
@client.log "push overview_list #{overview.link} for user #{@user.id}"
|
||||||
|
|
||||||
# send update to browser
|
# send update to browser
|
||||||
|
@ -174,6 +168,12 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base
|
||||||
event: 'ticket_overview_list',
|
event: 'ticket_overview_list',
|
||||||
data: data,
|
data: data,
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
result = {
|
||||||
|
event: 'ticket_overview_list',
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
results.push result
|
||||||
end
|
end
|
||||||
|
|
||||||
assets.flush
|
assets.flush
|
||||||
|
|
|
@ -26,10 +26,10 @@ class Sessions::Event::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def websocket_send(recipient_client_id, data)
|
def websocket_send(recipient_client_id, data)
|
||||||
msg = if data.class != Array
|
msg = if data.instance_of?(Array)
|
||||||
"[#{data.to_json}]"
|
|
||||||
else
|
|
||||||
data.to_json
|
data.to_json
|
||||||
|
else
|
||||||
|
"[#{data.to_json}]"
|
||||||
end
|
end
|
||||||
if @clients[recipient_client_id]
|
if @clients[recipient_client_id]
|
||||||
log 'debug', "ws send #{msg}", recipient_client_id
|
log 'debug', "ws send #{msg}", recipient_client_id
|
||||||
|
|
|
@ -253,10 +253,10 @@ class TwitterSync
|
||||||
if item['entities']
|
if item['entities']
|
||||||
|
|
||||||
item['entities']['user_mentions']&.each do |local_user|
|
item['entities']['user_mentions']&.each do |local_user|
|
||||||
if !to
|
if to
|
||||||
to = ''
|
|
||||||
else
|
|
||||||
to += ', '
|
to += ', '
|
||||||
|
else
|
||||||
|
to = ''
|
||||||
end
|
end
|
||||||
to += "@#{local_user['screen_name']}"
|
to += "@#{local_user['screen_name']}"
|
||||||
mention_ids.push local_user['id']
|
mention_ids.push local_user['id']
|
||||||
|
@ -380,10 +380,10 @@ class TwitterSync
|
||||||
from = "@#{tweet.user.screen_name}"
|
from = "@#{tweet.user.screen_name}"
|
||||||
mention_ids = []
|
mention_ids = []
|
||||||
tweet.user_mentions&.each do |local_user|
|
tweet.user_mentions&.each do |local_user|
|
||||||
if !to
|
if to
|
||||||
to = ''
|
|
||||||
else
|
|
||||||
to += ', '
|
to += ', '
|
||||||
|
else
|
||||||
|
to = ''
|
||||||
end
|
end
|
||||||
to += "@#{local_user.screen_name}"
|
to += "@#{local_user.screen_name}"
|
||||||
mention_ids.push local_user.id
|
mention_ids.push local_user.id
|
||||||
|
|
|
@ -115,10 +115,10 @@ class WebsocketServer
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.websocket_send(client_id, data)
|
def self.websocket_send(client_id, data)
|
||||||
msg = if data.class != Array
|
msg = if data.instance_of?(Array)
|
||||||
"[#{data.to_json}]"
|
|
||||||
else
|
|
||||||
data.to_json
|
data.to_json
|
||||||
|
else
|
||||||
|
"[#{data.to_json}]"
|
||||||
end
|
end
|
||||||
log 'debug', "send #{msg}", client_id
|
log 'debug', "send #{msg}", client_id
|
||||||
if !@clients[client_id]
|
if !@clients[client_id]
|
||||||
|
|
|
@ -7,8 +7,8 @@ FactoryBot.define do
|
||||||
area { 'Email::Dummy' }
|
area { 'Email::Dummy' }
|
||||||
group { ::Group.find(1) }
|
group { ::Group.find(1) }
|
||||||
active { true }
|
active { true }
|
||||||
options {}
|
options { nil }
|
||||||
preferences {}
|
preferences { nil }
|
||||||
updated_by_id { 1 }
|
updated_by_id { 1 }
|
||||||
created_by_id { 1 }
|
created_by_id { 1 }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :import_job do
|
factory :import_job do
|
||||||
name { 'Import::Test' }
|
name { 'Import::Test' }
|
||||||
payload {}
|
payload { nil }
|
||||||
dry_run { false }
|
dry_run { false }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :notification_factory_renderer, class: NotificationFactory::Renderer do
|
factory :notification_factory_renderer, class: NotificationFactory::Renderer do
|
||||||
objects {}
|
objects { nil }
|
||||||
locale { 'en-en' }
|
locale { 'en-en' }
|
||||||
template { '' }
|
template { '' }
|
||||||
escape { true }
|
escape { true }
|
||||||
|
|
|
@ -4,7 +4,7 @@ FactoryBot.define do
|
||||||
key { 'Ticket-1234' }
|
key { 'Ticket-1234' }
|
||||||
add_attribute(:callback) { 'TicketZoom' }
|
add_attribute(:callback) { 'TicketZoom' }
|
||||||
params { {} }
|
params { {} }
|
||||||
state {}
|
state { nil }
|
||||||
prio { 1 }
|
prio { 1 }
|
||||||
notify { false }
|
notify { false }
|
||||||
user_id { 1 }
|
user_id { 1 }
|
||||||
|
|
|
@ -31,7 +31,7 @@ RSpec.describe ApplicationHandleInfo do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'resets ApplicationHandleInfo to its original value' do
|
it 'resets ApplicationHandleInfo to its original value' do
|
||||||
described_class.use('bar') {}
|
described_class.use('bar') { nil }
|
||||||
|
|
||||||
expect(described_class.current).to eq('foo')
|
expect(described_class.current).to eq('foo')
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,7 +72,7 @@ RSpec.describe 'Gmail XOAUTH2' do # rubocop:disable RSpec/DescribeClass
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't remove email address assignments" do
|
it "doesn't remove email address assignments" do
|
||||||
expect { Channel.where(area: 'Google::Account').find_each {} }.not_to change { email_address.reload.channel_id }
|
expect { Channel.where(area: 'Google::Account').find_each { nil } }.not_to change { email_address.reload.channel_id }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ RSpec.describe 'Microsoft365 XOAUTH2' do # rubocop:disable RSpec/DescribeClass
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't remove email address assignments" do
|
it "doesn't remove email address assignments" do
|
||||||
expect { Channel.where(area: 'Microsoft365::Account').find_each {} }.not_to change { email_address.reload.channel_id }
|
expect { Channel.where(area: 'Microsoft365::Account').find_each { nil } }.not_to change { email_address.reload.channel_id }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ module KnowledgeBasePublicMatchers
|
||||||
match { breadcrumb_found? && of_specified_length? }
|
match { breadcrumb_found? && of_specified_length? }
|
||||||
|
|
||||||
chain(:with, :length)
|
chain(:with, :length)
|
||||||
chain(:items) {}
|
chain(:items) { nil }
|
||||||
|
|
||||||
description do
|
description do
|
||||||
if @length.present?
|
if @length.present?
|
||||||
|
|
|
@ -265,13 +265,13 @@ class TestCase < ActiveSupport::TestCase
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
login_failed = false
|
login_failed = false
|
||||||
if !instance.find_elements(css: '.user-menu .user a')[0]
|
if instance.find_elements(css: '.user-menu .user a')[0]
|
||||||
login_failed = true
|
|
||||||
else
|
|
||||||
login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title')
|
login = instance.find_elements(css: '.user-menu .user a')[0].attribute('title')
|
||||||
if login != params[:username]
|
if login != params[:username]
|
||||||
login_failed = true
|
login_failed = true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
login_failed = true
|
||||||
end
|
end
|
||||||
if login_failed
|
if login_failed
|
||||||
if params[:success] == false
|
if params[:success] == false
|
||||||
|
@ -784,14 +784,14 @@ class TestCase < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if !params[:slow]
|
if params[:slow]
|
||||||
element.send_keys(params[:value])
|
|
||||||
else
|
|
||||||
element.send_keys('')
|
element.send_keys('')
|
||||||
keys = params[:value].to_s.split('')
|
keys = params[:value].to_s.split('')
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
instance.action.send_keys(key).perform
|
instance.action.send_keys(key).perform
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
element.send_keys(params[:value])
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
@ -801,14 +801,14 @@ class TestCase < ActiveSupport::TestCase
|
||||||
element = instance.find_elements(css: params[:css])[0]
|
element = instance.find_elements(css: params[:css])[0]
|
||||||
raise "No such element '#{params[:css]}'" if !element
|
raise "No such element '#{params[:css]}'" if !element
|
||||||
|
|
||||||
if !params[:slow]
|
if params[:slow]
|
||||||
element.send_keys(params[:value])
|
|
||||||
else
|
|
||||||
element.send_keys('')
|
element.send_keys('')
|
||||||
keys = params[:value].to_s.split('')
|
keys = params[:value].to_s.split('')
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
instance.action.send_keys(key).perform
|
instance.action.send_keys(key).perform
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
element.send_keys(params[:value])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue