Maintenance: Updated to Rails 6.0.4 and the new Zeitwerk autoloader.
This changes the minimum supported version of PostgreSQL to 9.3.
This commit is contained in:
parent
341bdd6eb9
commit
ca56de3648
151 changed files with 409 additions and 458 deletions
|
@ -45,7 +45,7 @@ variables:
|
|||
# as a key for the cache to avoid cache growth and incompatibilities between
|
||||
# the gems. Search hook: 2.6.6 (change it when updating the Ruby version too)
|
||||
cache:
|
||||
key: "centos7ruby266"
|
||||
key: "centos7ruby266rails6"
|
||||
paths:
|
||||
- vendor/ruby
|
||||
# ATTENTION: This should be a dedicated cache only used in the job "TODO".
|
||||
|
|
|
@ -21,6 +21,17 @@ shellcheck:
|
|||
script:
|
||||
- shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | grep -v "/vendor/")
|
||||
|
||||
zeitwerk_check:
|
||||
<<: *template_pre
|
||||
extends:
|
||||
- .tags_docker
|
||||
- .services_postgresql
|
||||
script:
|
||||
- bundle install -j $(nproc) --path vendor
|
||||
- bundle exec ruby script/build/database_config.rb
|
||||
- bundle exec rake zammad:db:init
|
||||
- bundle exec rails zeitwerk:check
|
||||
|
||||
coffeelint:
|
||||
<<: *template_pre
|
||||
script:
|
||||
|
|
|
@ -15,9 +15,7 @@ AllCops:
|
|||
NewCops: enable
|
||||
DisplayCopNames: true
|
||||
Exclude:
|
||||
- 'bin/rails'
|
||||
- 'bin/rake'
|
||||
- 'bin/spring'
|
||||
- 'bin/*'
|
||||
- 'db/schema.rb'
|
||||
- 'vendor/**/*'
|
||||
- 'node_modules/**/*'
|
||||
|
|
|
@ -61,8 +61,6 @@ Metrics/AbcSize:
|
|||
- 'app/controllers/recent_view_controller.rb'
|
||||
- 'app/controllers/reports_controller.rb'
|
||||
- 'app/controllers/search_controller.rb'
|
||||
- 'app/controllers/sessions/collection_base.rb'
|
||||
- 'app/controllers/sessions/collection_ticket.rb'
|
||||
- 'app/controllers/sessions_controller.rb'
|
||||
- 'app/controllers/settings_controller.rb'
|
||||
- 'app/controllers/text_modules_controller.rb'
|
||||
|
@ -321,6 +319,8 @@ Metrics/AbcSize:
|
|||
- 'lib/service/geo_calendar/zammad.rb'
|
||||
- 'lib/service/geo_ip/zammad.rb'
|
||||
- 'lib/service/geo_location/gmaps.rb'
|
||||
- 'lib/session_helper/collection_base.rb'
|
||||
- 'lib/session_helper/collection_ticket.rb'
|
||||
- 'lib/sessions.rb'
|
||||
- 'lib/sessions/backend/activity_stream.rb'
|
||||
- 'lib/sessions/backend/base.rb'
|
||||
|
@ -478,8 +478,6 @@ Metrics/CyclomaticComplexity:
|
|||
- 'app/controllers/organizations_controller.rb'
|
||||
- 'app/controllers/reports_controller.rb'
|
||||
- 'app/controllers/search_controller.rb'
|
||||
- 'app/controllers/sessions/collection_base.rb'
|
||||
- 'app/controllers/sessions/collection_ticket.rb'
|
||||
- 'app/controllers/sessions_controller.rb'
|
||||
- 'app/controllers/ticket_articles_controller.rb'
|
||||
- 'app/controllers/tickets_controller.rb'
|
||||
|
@ -638,6 +636,8 @@ Metrics/CyclomaticComplexity:
|
|||
- 'lib/secure_mailing/smime/incoming.rb'
|
||||
- 'lib/sequencer/unit/import/zendesk/sub_sequence/base.rb'
|
||||
- 'lib/service/geo_ip/zammad.rb'
|
||||
- 'lib/session_helper/collection_base.rb'
|
||||
- 'lib/session_helper/collection_ticket.rb'
|
||||
- 'lib/sessions.rb'
|
||||
- 'lib/sessions/backend/activity_stream.rb'
|
||||
- 'lib/sessions/backend/ticket_overview_list.rb'
|
||||
|
@ -715,8 +715,6 @@ Metrics/PerceivedComplexity:
|
|||
- 'app/controllers/organizations_controller.rb'
|
||||
- 'app/controllers/reports_controller.rb'
|
||||
- 'app/controllers/search_controller.rb'
|
||||
- 'app/controllers/sessions/collection_base.rb'
|
||||
- 'app/controllers/sessions/collection_ticket.rb'
|
||||
- 'app/controllers/sessions_controller.rb'
|
||||
- 'app/controllers/ticket_articles_controller.rb'
|
||||
- 'app/controllers/tickets_controller.rb'
|
||||
|
@ -865,6 +863,8 @@ Metrics/PerceivedComplexity:
|
|||
- 'lib/search_index_backend.rb'
|
||||
- 'lib/secure_mailing/smime/incoming.rb'
|
||||
- 'lib/service/geo_ip/zammad.rb'
|
||||
- 'lib/session_helper/collection_base.rb'
|
||||
- 'lib/session_helper/collection_ticket.rb'
|
||||
- 'lib/sessions.rb'
|
||||
- 'lib/sessions/backend/activity_stream.rb'
|
||||
- 'lib/sessions/backend/ticket_overview_list.rb'
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -4,7 +4,7 @@ source 'https://rubygems.org'
|
|||
|
||||
# core - base
|
||||
ruby '2.6.6'
|
||||
gem 'rails', '5.2.4.6'
|
||||
gem 'rails', '6.0.4'
|
||||
|
||||
# core - rails additions
|
||||
gem 'activerecord-import'
|
||||
|
|
142
Gemfile.lock
142
Gemfile.lock
|
@ -49,41 +49,53 @@ GEM
|
|||
specs:
|
||||
aasm (5.0.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.2.4.6)
|
||||
actionpack (= 5.2.4.6)
|
||||
actioncable (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.4.6)
|
||||
actionpack (= 5.2.4.6)
|
||||
actionview (= 5.2.4.6)
|
||||
activejob (= 5.2.4.6)
|
||||
actionmailbox (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
activejob (= 6.0.4)
|
||||
activerecord (= 6.0.4)
|
||||
activestorage (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
actionview (= 6.0.4)
|
||||
activejob (= 6.0.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.4.6)
|
||||
actionview (= 5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
actionpack (6.0.4)
|
||||
actionview (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
activerecord (= 6.0.4)
|
||||
activestorage (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
activerecord (5.2.4.6)
|
||||
activemodel (= 5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
arel (>= 9.0)
|
||||
activerecord-import (1.0.2)
|
||||
activemodel (6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
activerecord (6.0.4)
|
||||
activemodel (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
activerecord-import (1.0.5)
|
||||
activerecord (>= 3.2)
|
||||
activerecord-nulldb-adapter (0.3.9)
|
||||
activerecord-nulldb-adapter (0.4.0)
|
||||
activerecord (>= 2.0.0)
|
||||
activerecord-session_store (2.0.0)
|
||||
actionpack (>= 5.2.4.1)
|
||||
|
@ -91,20 +103,21 @@ GEM
|
|||
multi_json (~> 1.11, >= 1.11.2)
|
||||
rack (>= 2.0.8, < 3)
|
||||
railties (>= 5.2.4.1)
|
||||
activestorage (5.2.4.6)
|
||||
actionpack (= 5.2.4.6)
|
||||
activerecord (= 5.2.4.6)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.4.6)
|
||||
activestorage (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
activejob (= 6.0.4)
|
||||
activerecord (= 6.0.4)
|
||||
marcel (~> 1.0.0)
|
||||
activesupport (6.0.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
acts_as_list (0.9.19)
|
||||
activerecord (>= 3.0)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
acts_as_list (1.0.1)
|
||||
activerecord (>= 4.2)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
arel (9.0.0)
|
||||
argon2 (2.0.2)
|
||||
ffi (~> 1.9)
|
||||
ffi-compiler (>= 0.1)
|
||||
|
@ -137,9 +150,9 @@ GEM
|
|||
clearbit (0.2.8)
|
||||
nestful (~> 1.1.0)
|
||||
coderay (1.1.2)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-rails (5.0.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0)
|
||||
railties (>= 5.2.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
|
@ -148,9 +161,9 @@ GEM
|
|||
coffee-script
|
||||
execjs
|
||||
json
|
||||
composite_primary_keys (11.2.0)
|
||||
activerecord (~> 5.2.1)
|
||||
concurrent-ruby (1.1.8)
|
||||
composite_primary_keys (12.0.2)
|
||||
activerecord (~> 6.0.0)
|
||||
concurrent-ruby (1.1.9)
|
||||
coveralls (0.8.23)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov (~> 0.16.1)
|
||||
|
@ -163,10 +176,10 @@ GEM
|
|||
daemons (1.3.1)
|
||||
dalli (2.7.10)
|
||||
debug_inspector (0.0.3)
|
||||
delayed_job (4.1.7)
|
||||
activesupport (>= 3.0, < 5.3)
|
||||
delayed_job_active_record (4.1.3)
|
||||
activerecord (>= 3.0, < 5.3)
|
||||
delayed_job (4.1.8)
|
||||
activesupport (>= 3.0, < 6.1)
|
||||
delayed_job_active_record (4.1.4)
|
||||
activerecord (>= 3.0, < 6.1)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
deprecation_toolkit (1.4.0)
|
||||
activesupport (>= 4.2)
|
||||
|
@ -275,23 +288,19 @@ GEM
|
|||
logging (2.2.2)
|
||||
little-plugger (~> 1.1)
|
||||
multi_json (~> 1.10)
|
||||
loofah (2.9.1)
|
||||
loofah (2.10.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
lumberjack (1.0.13)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
marcel (1.0.1)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
method_source (0.9.2)
|
||||
mime-types (3.2.2)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.0331)
|
||||
mimemagic (0.3.10)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_mime (1.1.0)
|
||||
mini_portile2 (2.5.1)
|
||||
mini_portile2 (2.5.3)
|
||||
mini_racer (0.2.9)
|
||||
libv8 (>= 6.9.411)
|
||||
minitest (5.14.4)
|
||||
|
@ -306,7 +315,7 @@ GEM
|
|||
net-ldap (0.16.1)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.7)
|
||||
nokogiri (1.11.5)
|
||||
nokogiri (1.11.7)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
nori (2.6.0)
|
||||
|
@ -396,18 +405,20 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.4.6)
|
||||
actioncable (= 5.2.4.6)
|
||||
actionmailer (= 5.2.4.6)
|
||||
actionpack (= 5.2.4.6)
|
||||
actionview (= 5.2.4.6)
|
||||
activejob (= 5.2.4.6)
|
||||
activemodel (= 5.2.4.6)
|
||||
activerecord (= 5.2.4.6)
|
||||
activestorage (= 5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
rails (6.0.4)
|
||||
actioncable (= 6.0.4)
|
||||
actionmailbox (= 6.0.4)
|
||||
actionmailer (= 6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
actiontext (= 6.0.4)
|
||||
actionview (= 6.0.4)
|
||||
activejob (= 6.0.4)
|
||||
activemodel (= 6.0.4)
|
||||
activerecord (= 6.0.4)
|
||||
activestorage (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.4.6)
|
||||
railties (= 6.0.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
|
@ -418,12 +429,12 @@ GEM
|
|||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (5.2.4.6)
|
||||
actionpack (= 5.2.4.6)
|
||||
activesupport (= 5.2.4.6)
|
||||
railties (6.0.4)
|
||||
actionpack (= 6.0.4)
|
||||
activesupport (= 6.0.4)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
raindrops (0.19.0)
|
||||
rake (12.3.3)
|
||||
|
@ -562,12 +573,13 @@ GEM
|
|||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
websocket-driver (0.7.3)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
writeexcel (1.0.5)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.4.2)
|
||||
zendesk_api (1.19.0)
|
||||
faraday (~> 0.9)
|
||||
hashie (>= 3.5.2, < 4.0.0)
|
||||
|
@ -650,7 +662,7 @@ DEPENDENCIES
|
|||
pundit
|
||||
pundit-matchers
|
||||
rack-livereload
|
||||
rails (= 5.2.4.6)
|
||||
rails (= 6.0.4)
|
||||
rails-controller-testing
|
||||
rb-fsevent
|
||||
rchardet (>= 1.8.0)
|
||||
|
|
|
@ -98,7 +98,6 @@ class ChannelsSmsController < ApplicationController
|
|||
list = []
|
||||
Dir.glob(Rails.root.join('app/models/channel/driver/sms/*.rb')).each do |path|
|
||||
filename = File.basename(path)
|
||||
require_dependency "channel/driver/sms/#{filename.sub('.rb', '')}"
|
||||
list.push Channel.driver_class("sms/#{filename}").definition
|
||||
end
|
||||
list
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'channel/driver/twitter'
|
||||
|
||||
class ChannelsTwitterController < ApplicationController
|
||||
prepend_before_action -> { authentication_check && authorize! }, except: %i[webhook_incoming webhook_verify]
|
||||
skip_before_action :verify_csrf_token, only: %i[webhook_incoming webhook_verify]
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'ldap'
|
||||
require_dependency 'ldap/user'
|
||||
require_dependency 'ldap/group'
|
||||
|
||||
class Integration::LdapController < ApplicationController
|
||||
include Integration::ImportJobBase
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ class SearchController < ApplicationController
|
|||
if objects_with_direct_search_index.present?
|
||||
items = SearchIndexBackend.search(query, objects_with_direct_search_index, limit: limit)
|
||||
items.each do |item|
|
||||
require_dependency item[:type].to_filename
|
||||
local_class = item[:type].constantize
|
||||
record = local_class.lookup(id: item[:id])
|
||||
next if !record
|
||||
|
|
|
@ -5,6 +5,8 @@ class ApplicationJob < ActiveJob::Base
|
|||
include ApplicationJob::HasQueuingPriority
|
||||
include ApplicationJob::HasCustomLogging
|
||||
|
||||
ActiveJob::Logging::LogSubscriber.detach_from :active_job
|
||||
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'ldap'
|
||||
require_dependency 'ldap/user'
|
||||
|
||||
class MigrateLdapSamaccountnameToUidJob < ApplicationJob
|
||||
|
||||
def perform
|
||||
|
|
|
@ -158,7 +158,6 @@ get assets of object list
|
|||
|
||||
def assets_of_object_list(list, assets = {})
|
||||
list.each do |item|
|
||||
require_dependency item['object'].to_filename
|
||||
record = item['object'].constantize.lookup(id: item['o_id'])
|
||||
next if record.blank?
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ returns
|
|||
return updated_at if updated_at
|
||||
|
||||
# if we do not have it cached, do lookup
|
||||
updated_at = order(updated_at: :desc).limit(1).pluck(:updated_at).first
|
||||
updated_at = order(updated_at: :desc).limit(1).pick(:updated_at)
|
||||
|
||||
return if !updated_at
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class Authorization < ApplicationModel
|
|||
after_update :delete_user_cache
|
||||
after_destroy :delete_user_cache
|
||||
validates :user_id, presence: true
|
||||
validates :uid, presence: true, uniqueness: { scope: :provider }
|
||||
validates :uid, presence: true, uniqueness: { case_sensitive: true, scope: :provider }
|
||||
validates :provider, presence: true
|
||||
|
||||
def self.find_from_hash(hash)
|
||||
|
|
|
@ -315,12 +315,6 @@ load channel driver and return class
|
|||
=end
|
||||
|
||||
def self.driver_class(adapter)
|
||||
# we need to require each channel backend individually otherwise we get a
|
||||
# 'warning: toplevel constant Twitter referenced by Channel::Driver::Twitter' error e.g.
|
||||
# so we have to convert the channel name to the filename via Rails String.underscore
|
||||
# http://stem.ps/rails/2015/01/25/ruby-gotcha-toplevel-constant-referenced-by.html
|
||||
require_dependency "channel/driver/#{adapter.to_filename}"
|
||||
|
||||
"::Channel::Driver::#{adapter.to_classname}".constantize
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class Channel::Driver::Sms::Twilio
|
|||
body: attr[:message],
|
||||
)
|
||||
|
||||
raise result.error_message if result.error_code.positive?
|
||||
raise result.error_message if result&.error_code&.positive?
|
||||
end
|
||||
|
||||
true
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'external_credential/twitter'
|
||||
|
||||
class Channel::Driver::Twitter
|
||||
|
||||
=begin
|
||||
|
|
|
@ -159,7 +159,7 @@ module HasGroups
|
|||
# @return [Hash<String=>String,Array<String>>] The given map
|
||||
def group_names_access_map=(name_access_map)
|
||||
groups_access_map_store(name_access_map) do |group_name|
|
||||
Group.where(name: group_name).pluck(:id).first
|
||||
Group.where(name: group_name).pick(:id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module HasTicketCreateScreenImpact
|
|||
def push_ticket_create_screen?
|
||||
return true if destroyed?
|
||||
|
||||
%w[id name active].any? do |attribute|
|
||||
%w[id name active updated_at].any? do |attribute|
|
||||
saved_change_to_attribute?(attribute)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -72,6 +72,7 @@ class DataPrivacyTask::Validation < ActiveModel::Validator
|
|||
deletable: deletable
|
||||
).where.not(
|
||||
id: record.id,
|
||||
).where.not(
|
||||
state: 'failed'
|
||||
).exists?
|
||||
end
|
||||
|
|
|
@ -35,9 +35,7 @@ class ExternalCredential < ApplicationModel
|
|||
end
|
||||
|
||||
def self.load_backend(provider)
|
||||
adapter = "ExternalCredential::#{provider.camelcase}"
|
||||
require_dependency adapter.to_filename.to_s
|
||||
adapter.constantize
|
||||
"ExternalCredential::#{provider.camelcase}".constantize
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ class KnowledgeBase::Answer::Translation < ApplicationModel
|
|||
|
||||
validates :title, presence: true, length: { maximum: 250 }
|
||||
validates :content, presence: true
|
||||
validates :kb_locale_id, uniqueness: { scope: :answer_id }
|
||||
validates :kb_locale_id, uniqueness: { case_sensitive: true, scope: :answer_id }
|
||||
|
||||
scope :neighbours_of, ->(translation) { joins(:answer).where(knowledge_base_answers: { category_id: translation.answer&.category_id }) }
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class KnowledgeBase::Category::Translation < ApplicationModel
|
|||
validates :category, presence: true
|
||||
|
||||
validates :title, presence: true
|
||||
validates :kb_locale_id, uniqueness: { scope: :category_id }
|
||||
validates :kb_locale_id, uniqueness: { case_sensitive: true, scope: :category_id }
|
||||
|
||||
scope :neighbours_of, ->(translation) { joins(:category).where(knowledge_base_categories: { parent_id: translation.category&.parent_id }) }
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ class KnowledgeBase::Locale < ApplicationModel
|
|||
belongs_to :knowledge_base, inverse_of: :kb_locales, touch: true
|
||||
belongs_to :system_locale, inverse_of: :knowledge_base_locales, class_name: '::Locale'
|
||||
|
||||
validates :primary, uniqueness: { scope: %i[system_locale_id knowledge_base_id] }, if: :primary?
|
||||
validates :system_locale_id, uniqueness: { scope: :knowledge_base_id }
|
||||
validates :primary, uniqueness: { case_sensitive: true, scope: %i[system_locale_id knowledge_base_id] }, if: :primary?
|
||||
validates :system_locale_id, uniqueness: { case_sensitive: true, scope: :knowledge_base_id }
|
||||
|
||||
has_many :knowledge_base_translations, class_name: 'KnowledgeBase::Translation',
|
||||
inverse_of: :kb_locale,
|
||||
|
|
|
@ -11,7 +11,7 @@ class KnowledgeBase::Translation < ApplicationModel
|
|||
belongs_to :kb_locale, inverse_of: :knowledge_base_translations, class_name: 'KnowledgeBase::Locale'
|
||||
|
||||
validates :title, presence: true, length: { maximum: 250 }
|
||||
validates :kb_locale_id, uniqueness: { scope: :knowledge_base_id }
|
||||
validates :kb_locale_id, uniqueness: { case_sensitive: true, scope: :knowledge_base_id }
|
||||
|
||||
def assets(data)
|
||||
return data if assets_added_to?(data)
|
||||
|
|
|
@ -51,7 +51,8 @@ class ObjectManager::Attribute::Validation < ActiveModel::Validator
|
|||
def sanitize_memory_cache
|
||||
@model_attributes = nil
|
||||
|
||||
latest_cache_key = active_attributes_in_db.cache_key
|
||||
active_attributes = active_attributes_in_db
|
||||
latest_cache_key = active_attributes.cache_key + active_attributes.cache_version
|
||||
return if @previous_cache_key == latest_cache_key
|
||||
|
||||
@previous_cache_key = latest_cache_key
|
||||
|
|
|
@ -116,7 +116,7 @@ returns
|
|||
|
||||
def self.with_permissions(keys)
|
||||
permission_ids = Role.permission_ids_by_name(keys)
|
||||
Role.joins(:roles_permissions).joins(:permissions).where(
|
||||
Role.joins(:permissions_roles).joins(:permissions).where(
|
||||
'permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true
|
||||
).distinct()
|
||||
end
|
||||
|
@ -140,7 +140,7 @@ returns
|
|||
|
||||
def with_permission?(keys)
|
||||
permission_ids = Role.permission_ids_by_name(keys)
|
||||
return true if Role.joins(:roles_permissions).joins(:permissions).where(
|
||||
return true if Role.joins(:permissions_roles).joins(:permissions).where(
|
||||
'roles.id = ? AND permissions_roles.permission_id IN (?) AND permissions.active = ?', id, permission_ids, true
|
||||
).distinct().count.nonzero?
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
class SMIMECertificate < ApplicationModel
|
||||
validates :fingerprint, uniqueness: true
|
||||
validates :fingerprint, uniqueness: { case_sensitive: true }
|
||||
|
||||
def self.parse(raw)
|
||||
OpenSSL::X509::Certificate.new(raw.gsub(%r{(?:TRUSTED\s)?(CERTIFICATE---)}, '\1'))
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'store/object'
|
||||
require_dependency 'store/file'
|
||||
|
||||
class Store < ApplicationModel
|
||||
PREFERENCES_SIZE_MAX = 2400
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'stats/ticket_reopen'
|
||||
|
||||
# Adds new and updated tickets to the reopen log processing.
|
||||
module Ticket::CallsStatsTicketReopenLog
|
||||
extend ActiveSupport::Concern
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'escalation'
|
||||
|
||||
module Ticket::Escalation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ or
|
|||
return timestamp.to_s
|
||||
end
|
||||
|
||||
record = Translation.where(locale: locale, source: 'timestamp', format: 'time').pluck(:target).first
|
||||
record = Translation.where(locale: locale, source: 'timestamp', format: 'time').pick(:target)
|
||||
return timestamp.to_s if !record
|
||||
|
||||
record.sub!('dd', format('%<day>02d', day: timestamp.day))
|
||||
|
@ -286,7 +286,7 @@ or
|
|||
|
||||
return date.to_s if date.class != Date
|
||||
|
||||
record = Translation.where(locale: locale, source: 'date', format: 'time').pluck(:target).first
|
||||
record = Translation.where(locale: locale, source: 'date', format: 'time').pick(:target)
|
||||
return date.to_s if !record
|
||||
|
||||
record.sub!('dd', format('%<day>02d', day: date.day))
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'karma/user'
|
||||
|
||||
class User < ApplicationModel
|
||||
include CanBeAuthorized
|
||||
include CanBeImported
|
||||
|
@ -14,7 +12,7 @@ class User < ApplicationModel
|
|||
include HasGroups
|
||||
include HasRoles
|
||||
include HasObjectManagerAttributesValidation
|
||||
include HasTicketCreateScreenImpact
|
||||
include ::HasTicketCreateScreenImpact
|
||||
include HasTaskbars
|
||||
include User::HasTicketCreateScreenImpact
|
||||
include User::Assets
|
||||
|
@ -461,7 +459,7 @@ returns
|
|||
end
|
||||
next if permission_ids.blank?
|
||||
|
||||
Role.joins(:roles_permissions).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct().pluck(:id).each do |role_id|
|
||||
Role.joins(:permissions_roles).joins(:permissions).where('permissions_roles.permission_id IN (?) AND roles.active = ? AND permissions.active = ?', permission_ids, true, true).distinct().pluck(:id).each do |role_id|
|
||||
role_ids.push role_id
|
||||
end
|
||||
total_role_ids.push role_ids
|
||||
|
@ -475,7 +473,7 @@ returns
|
|||
end
|
||||
condition += 'roles_users.role_id IN (?)'
|
||||
end
|
||||
User.joins(:users_roles).where("(#{condition}) AND users.active = ?", *total_role_ids, true).distinct.order(:id)
|
||||
User.joins(:roles_users).where("(#{condition}) AND users.active = ?", *total_role_ids, true).distinct.order(:id)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
@ -686,11 +684,11 @@ returns
|
|||
def self.of_role(role, group_ids = nil)
|
||||
roles_ids = Role.where(active: true, name: role).map(&:id)
|
||||
if !group_ids
|
||||
return User.where(active: true).joins(:users_roles).where('roles_users.role_id' => roles_ids).order('users.updated_at DESC')
|
||||
return User.where(active: true).joins(:roles_users).where('roles_users.role_id' => roles_ids).order('users.updated_at DESC')
|
||||
end
|
||||
|
||||
User.where(active: true)
|
||||
.joins(:users_roles)
|
||||
.joins(:roles_users)
|
||||
.joins(:users_groups)
|
||||
.where('roles_users.role_id IN (?) AND users_groups.group_ids IN (?)', roles_ids, group_ids).order('users.updated_at DESC')
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
class User
|
||||
module HasTicketCreateScreenImpact
|
||||
module User::HasTicketCreateScreenImpact
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def push_ticket_create_screen?
|
||||
|
@ -12,5 +11,4 @@ class User
|
|||
|
||||
permissions?('ticket.agent')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
12
bin/setup
12
bin/setup
|
@ -2,7 +2,6 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require 'fileutils'
|
||||
include FileUtils # rubocop:disable Style/MixinUsage
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
|
@ -11,24 +10,25 @@ def system!(*args)
|
|||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
FileUtils.chdir APP_ROOT do
|
||||
# This script is a way to setup or update your development environment automatically.
|
||||
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts '== Installing dependencies =='
|
||||
system! 'gem install bundler --conservative'
|
||||
system('bundle check') || system!('bundle install')
|
||||
|
||||
# Install JavaScript dependencies if using Yarn
|
||||
# Install JavaScript dependencies
|
||||
# system('bin/yarn')
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! 'bin/rails db:setup'
|
||||
system! 'bin/rails db:prepare'
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! 'bin/rails log:clear tmp:clear'
|
||||
|
|
10
bin/yarn
10
bin/yarn
|
@ -3,9 +3,11 @@
|
|||
|
||||
APP_ROOT = File.expand_path('..', __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
exec 'yarnpkg', *ARGV
|
||||
rescue Errno::ENOENT
|
||||
warn 'Yarn executable was not detected in the system.'
|
||||
warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
|
||||
begin
|
||||
exec "yarnpkg", *ARGV
|
||||
rescue Errno::ENOENT
|
||||
$stderr.puts "Yarn executable was not detected in the system."
|
||||
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,13 +15,26 @@ Bundler.require(*Rails.groups)
|
|||
module Zammad
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.2
|
||||
config.load_defaults 6.0
|
||||
|
||||
Rails.autoloaders.each do |autoloader|
|
||||
autoloader.do_not_eager_load "#{config.root}/lib/core_ext"
|
||||
autoloader.collapse "#{config.root}/lib/omniauth"
|
||||
autoloader.inflector.inflect(
|
||||
'github_database' => 'GithubDatabase',
|
||||
'otrs' => 'OTRS',
|
||||
'db' => 'DB',
|
||||
)
|
||||
end
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
# Application configuration can go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded after loading
|
||||
|
||||
# the framework and any gems in your application.
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.add_autoload_paths_to_load_path = false
|
||||
config.autoload_paths += %W[#{config.root}/lib]
|
||||
config.eager_load_paths += %W[#{config.root}/lib]
|
||||
|
||||
|
@ -36,6 +49,9 @@ module Zammad
|
|||
# define cache store
|
||||
config.cache_store = :zammad_file_store, Rails.root.join('tmp', "cache_file_store_#{Rails.env}"), { expires_in: 7.days }
|
||||
|
||||
# Rails 6.1 returns false when the enqueuing is aborted.
|
||||
config.active_job.return_false_on_aborted_enqueue = true
|
||||
|
||||
# default preferences by permission
|
||||
config.preferences_default_by_permission = {
|
||||
'ticket.agent' => {
|
||||
|
|
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: zammad_production
|
|
@ -18,6 +18,7 @@ Rails.application.configure do
|
|||
# Run rails dev:cache to toggle caching.
|
||||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
# config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
|
@ -26,7 +27,7 @@ Rails.application.configure do
|
|||
config.action_controller.perform_caching = false
|
||||
end
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
# config.active_storage.service = :local
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
|
@ -51,7 +52,7 @@ Rails.application.configure do
|
|||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
|
@ -69,4 +70,8 @@ Rails.application.configure do
|
|||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# TODO: New in Rails 6
|
||||
# See https://www.fngtps.com/2019/rails6-blocked-host/
|
||||
config.hosts.clear
|
||||
end
|
||||
|
|
|
@ -40,10 +40,10 @@ Rails.application.configure do
|
|||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||
# config.active_storage.service = :local
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# Mount Action Cable outside main process or domain.
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
@ -61,7 +61,7 @@ Rails.application.configure do
|
|||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "zammad_#{Rails.env}"
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Rails.application.configure do
|
|||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Store uploaded files on the local file system in a temporary directory
|
||||
# Store uploaded files on the local file system in a temporary directory.
|
||||
# config.active_storage.service = :test
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
@ -46,7 +46,7 @@ Rails.application.configure do
|
|||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Enable autoload
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.style_src :self, :https
|
||||
# # If you are using webpack-dev-server then specify webpack-dev-server host
|
||||
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
|
||||
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
|
@ -43,6 +45,9 @@ end
|
|||
# If you are using UJS then enable automatic nonce generation
|
||||
Rails.application.config.content_security_policy_nonce_generator = ->(_request) { SecureRandom.base64(16) }
|
||||
|
||||
# Set the nonce only to specific directives
|
||||
Rails.application.config.content_security_policy_nonce_directives = %w[script-src]
|
||||
|
||||
# Report CSP violations to a specified URI
|
||||
# For further information see the following documentation:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
# Rails' constant auto-loading resolves to 'rails/initializable' instead
|
||||
require_dependency 'zammad/application/initializer/db_preflight_check'
|
||||
|
||||
Zammad::Application::Initializer::DBPreflightCheck.perform
|
||||
Zammad::Application::Initializer::DbPreflightCheck.perform
|
||||
|
|
47
config/initializers/new_framework_defaults_6_0.rb
Normal file
47
config/initializers/new_framework_defaults_6_0.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 6.0 upgrade.
|
||||
#
|
||||
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
|
||||
# Don't force requests from old versions of IE to be UTF-8 encoded.
|
||||
# Rails.application.config.action_view.default_enforce_utf8 = false
|
||||
|
||||
# Embed purpose and expiry metadata inside signed and encrypted
|
||||
# cookies for increased security.
|
||||
#
|
||||
# This option is not backwards compatible with earlier Rails versions.
|
||||
# It's best enabled when your entire app is migrated and stable on 6.0.
|
||||
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
|
||||
|
||||
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
|
||||
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
|
||||
|
||||
# Return false instead of self when enqueuing is aborted from a callback.
|
||||
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
|
||||
|
||||
# Send Active Storage analysis and purge jobs to dedicated queues.
|
||||
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
|
||||
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
|
||||
|
||||
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
|
||||
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
|
||||
# Rails.application.config.active_storage.replace_on_assign_to_many = true
|
||||
|
||||
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
|
||||
#
|
||||
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
|
||||
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
|
||||
# If you send mail in the background, job workers need to have a copy of
|
||||
# MailDeliveryJob to ensure all delivery jobs are processed properly.
|
||||
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
|
||||
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
|
||||
|
||||
# Enable the same cache key to be reused when the object being cached of type
|
||||
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
|
||||
# of the relation's cache key into the cache version to support recycling cache key.
|
||||
# Rails.application.config.active_record.collection_cache_versioning = true
|
|
@ -1,20 +0,0 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# This is a workaround because `ActiveSupport::Subscriber` supports only `attach_to` but not `detach_from` in Rails 5.2.
|
||||
# `detach_from` was added with Rails 6.0: https://github.com/rails/rails/commit/ca19b7f5d86aa590077766cbe8006f952b6d4296
|
||||
# Once Rails 6.0 is used `ActiveJob::Logging::LogSubscriber.detach_from :active_job` needs to be added to `app/jobs/application_job.rb` instead.
|
||||
ActiveSupport.on_load(:active_job) do
|
||||
|
||||
# gather all `ActiveJob::Logging::LogSubscriber` event subscribers
|
||||
subscribers = ActiveSupport::Notifications.notifier.instance_variable_get(:@subscribers).select do |subscriber|
|
||||
subscriber.instance_variable_get(:@delegate).instance_of?(ActiveJob::Logging::LogSubscriber)
|
||||
end
|
||||
|
||||
# remove gathered event subscribers in a dedicated step to not work on iterating array
|
||||
subscribers.each do |subscriber|
|
||||
ActiveSupport::Notifications.notifier.unsubscribe(subscriber)
|
||||
end
|
||||
|
||||
# remove whole `ActiveJob::Logging::LogSubscriber` subscriber reference
|
||||
ActiveSupport::Subscriber.subscribers.delete_if { |subscriber| subscriber.instance_of?(ActiveJob::Logging::LogSubscriber) }
|
||||
end
|
|
@ -27,7 +27,7 @@
|
|||
# 'true': 'foo'
|
||||
#
|
||||
# To learn more, please read the Rails Internationalization guide
|
||||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
# available at https://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
Rails.application.routes.draw do
|
||||
|
||||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
||||
|
||||
# app init
|
||||
match '/init', to: 'init#index', via: :get
|
||||
match '/app', to: 'init#index', via: :get
|
||||
|
||||
# just remember to delete public/index.html.
|
||||
root to: 'init#index', via: :get
|
||||
root to: 'errors#routing', via: %i[post put delete options]
|
||||
root to: 'errors#routing', via: %i[post put delete options], as: nil
|
||||
|
||||
# load routes from external files
|
||||
dir = File.expand_path(__dir__)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
%w[
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
].each { |path| Spring.watch(path) }
|
||||
Spring.watch(
|
||||
'.ruby-version',
|
||||
'.rbenv-vars',
|
||||
'tmp/restart.txt',
|
||||
'tmp/caching-dev.txt',
|
||||
)
|
||||
|
||||
module Spring
|
||||
module Commands
|
||||
|
|
34
config/storage.yml
Normal file
34
config/storage.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
test:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("tmp/storage") %>
|
||||
|
||||
local:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("storage") %>
|
||||
|
||||
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||
# amazon:
|
||||
# service: S3
|
||||
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||
# region: us-east-1
|
||||
# bucket: your_own_bucket
|
||||
|
||||
# Remember not to checkin your GCS keyfile to a repository
|
||||
# google:
|
||||
# service: GCS
|
||||
# project: your_project
|
||||
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||
# bucket: your_own_bucket
|
||||
|
||||
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||
# microsoft:
|
||||
# service: AzureStorage
|
||||
# storage_account_name: your_account_name
|
||||
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||
# container: your_container_name
|
||||
|
||||
# mirror:
|
||||
# service: Mirror
|
||||
# primary: local
|
||||
# mirrors: [ amazon, google, microsoft ]
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# This migration comes from active_storage (originally 20180723000244)
|
||||
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
|
||||
|
||||
return if !table_exists?(:active_storage_blobs)
|
||||
|
||||
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
|
||||
end
|
||||
end
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'assets_set/proxy'
|
||||
|
||||
# The name AssetsSet combines the Assets term in Zammad with the Set class from the Ruby StdLib.
|
||||
# Zammad Assets serve the purpose to limit requests to the REST API. For a requested object all
|
||||
# related and relevant objects are collected recursively and then send to the client in one go.
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'ldap'
|
||||
require_dependency 'ldap/user'
|
||||
|
||||
class Auth
|
||||
class Ldap < Auth::Base
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ module ActiveRecord
|
|||
def pluck_as_hash(*column_names)
|
||||
column_names.flatten! # flatten args in case array was given
|
||||
|
||||
klass.enforce_raw_sql_whitelist(column_names) # keep up deprection as in #pluck to ensure smooth Rails 6 transition
|
||||
klass.disallow_raw_sql!(column_names) # validate parameters as in #pluck
|
||||
|
||||
pluck(*arel_columns(column_names))
|
||||
.map { |elem| pluck_as_hash_map(column_names, elem) }
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# rubocop:disable Naming/FileName
|
||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
if Kernel.respond_to?(:open_uri_original_open)
|
||||
|
@ -20,4 +19,3 @@ if Kernel.respond_to?(:open_uri_original_open)
|
|||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Naming/FileName
|
|
@ -227,8 +227,6 @@ returns on fail
|
|||
# connection test
|
||||
result_inbound = {}
|
||||
begin
|
||||
require_dependency "channel/driver/#{adapter.to_filename}"
|
||||
|
||||
driver_class = "Channel::Driver::#{adapter.to_classname}".constantize
|
||||
driver_instance = driver_class.new
|
||||
result_inbound = driver_instance.fetch(params[:options], nil, 'check')
|
||||
|
@ -330,8 +328,6 @@ returns on fail
|
|||
|
||||
# test connection
|
||||
begin
|
||||
require_dependency "channel/driver/#{adapter.to_filename}"
|
||||
|
||||
driver_class = "Channel::Driver::#{adapter.to_classname}".constantize
|
||||
driver_instance = driver_class.new
|
||||
driver_instance.send(
|
||||
|
|
|
@ -82,8 +82,6 @@ or
|
|||
fetch_result = nil
|
||||
|
||||
begin
|
||||
require_dependency "channel/driver/#{adapter.to_filename}"
|
||||
|
||||
driver_class = "Channel::Driver::#{adapter.to_classname}".constantize
|
||||
driver_instance = driver_class.new
|
||||
fetch_result = driver_instance.fetch(params[:inbound][:options], self, 'verify', subject)
|
||||
|
|
|
@ -57,7 +57,9 @@ class ExcelSheet::Ticket < ExcelSheet
|
|||
object_lookup: ObjectLookup.lookup(name: 'Ticket')
|
||||
)
|
||||
.where.not(
|
||||
name: header.pluck(:name),
|
||||
name: header.pluck(:name)
|
||||
)
|
||||
.where.not(
|
||||
display: header.pluck(:display)
|
||||
)
|
||||
.pluck_as_hash(:name, :display, :data_type, :data_option)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# rubocop:disable Rails/Output
|
||||
module FillDB
|
||||
module FillDb
|
||||
|
||||
=begin
|
||||
|
||||
fill your database with demo records
|
||||
|
||||
FillDB.load(
|
||||
FillDb.load(
|
||||
agents: 50,
|
||||
customers: 1000,
|
||||
groups: 20,
|
||||
|
@ -18,10 +18,10 @@ fill your database with demo records
|
|||
|
||||
or if you only want to create 100 tickets
|
||||
|
||||
FillDB.load(tickets: 100)
|
||||
FillDB.load(agents: 20)
|
||||
FillDB.load(overviews: 20)
|
||||
FillDB.load(tickets: 10000)
|
||||
FillDb.load(tickets: 100)
|
||||
FillDb.load(agents: 20)
|
||||
FillDb.load(overviews: 20)
|
||||
FillDb.load(tickets: 10000)
|
||||
|
||||
=end
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'mixin/rails_logger'
|
||||
|
||||
module Import
|
||||
class Exchange
|
||||
class Folder
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'ldap'
|
||||
require_dependency 'ldap/group'
|
||||
|
||||
module Import
|
||||
class Ldap < Import::IntegrationBase
|
||||
include Import::Mixin::Sequence
|
||||
|
|
|
@ -1,28 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# Rails autoload has some issues with same namend sub-classes
|
||||
# in the importer folder require AND simultaniuos requiring
|
||||
# of the same file in different threads so we need to
|
||||
# require them ourself
|
||||
require_dependency 'import/otrs/ticket'
|
||||
require_dependency 'import/otrs/ticket_factory'
|
||||
require_dependency 'import/otrs/article_customer'
|
||||
require_dependency 'import/otrs/article_customer_factory'
|
||||
require_dependency 'import/otrs/article'
|
||||
require_dependency 'import/otrs/article_factory'
|
||||
require_dependency 'import/otrs/article/attachment_factory'
|
||||
require_dependency 'import/otrs/history'
|
||||
require_dependency 'import/otrs/history_factory'
|
||||
require_dependency 'import/otrs/history/article'
|
||||
require_dependency 'import/otrs/history/move'
|
||||
require_dependency 'import/otrs/history/new_ticket'
|
||||
require_dependency 'import/otrs/history/priority_update'
|
||||
require_dependency 'import/otrs/history/state_update'
|
||||
require_dependency 'store'
|
||||
require_dependency 'store/object'
|
||||
require_dependency 'store/provider/db'
|
||||
require_dependency 'store/provider/file'
|
||||
|
||||
module Import
|
||||
module OTRS
|
||||
extend Import::Helper
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/otrs/dynamic_field'
|
||||
|
||||
module Import
|
||||
module OTRS
|
||||
class DynamicField
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/otrs/dynamic_field'
|
||||
|
||||
module Import
|
||||
module OTRS
|
||||
class DynamicField
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'ticket'
|
||||
|
||||
module Import
|
||||
module OTRS
|
||||
class Ticket
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
# this require is required (hehe) because of Rails autoloading
|
||||
# which causes strange behavior not inheriting correctly
|
||||
# from Import::OTRS::DynamicField
|
||||
require_dependency 'import/zendesk/object_attribute/base'
|
||||
|
||||
module Import
|
||||
class Zendesk
|
||||
module ObjectAttribute
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'net/ldap'
|
||||
require_dependency 'net/ldap/entry'
|
||||
|
||||
# Class for establishing LDAP connections. A wrapper around Net::LDAP needed for Auth and Sync.
|
||||
# ATTENTION: Loads custom 'net/ldap/entry' from 'lib/core_ext' which extends the Net::LDAP::Entry class.
|
||||
#
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
class Ldap
|
||||
|
||||
# Class for handling LDAP Groups.
|
||||
# ATTENTION: Make sure to add the following lines to your code if accessing this class.
|
||||
# Otherwise Rails will autoload the Group model or might throw parameter errors if crearing
|
||||
# an ::Ldap instance.
|
||||
#
|
||||
# @example
|
||||
# require_dependency 'ldap'
|
||||
# require_dependency 'ldap/group'
|
||||
class Group
|
||||
include Ldap::FilterLookup
|
||||
|
||||
|
@ -31,8 +24,6 @@ class Ldap
|
|||
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
||||
#
|
||||
# @example
|
||||
# require_dependency 'ldap'
|
||||
# require_dependency 'ldap/group'
|
||||
# ldap_group = Ldap::Group.new
|
||||
#
|
||||
# @return [nil]
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
class Ldap
|
||||
|
||||
# Class for handling LDAP Groups.
|
||||
# ATTENTION: Make sure to add the following lines to your code if accessing this class.
|
||||
# Otherwise Rails will autoload the Group model or might throw parameter errors if crearing
|
||||
# an ::Ldap instance.
|
||||
#
|
||||
# @example
|
||||
# require_dependency 'ldap'
|
||||
# require_dependency 'ldap/user'
|
||||
class User
|
||||
include Ldap::FilterLookup
|
||||
|
||||
|
@ -79,8 +72,6 @@ class Ldap
|
|||
# @param ldap [Ldap] An optional existing Ldap class instance. Default is a new connection with given configuration.
|
||||
#
|
||||
# @example
|
||||
# require_dependency 'ldap'
|
||||
# require_dependency 'ldap/user'
|
||||
# ldap_user = Ldap::User.new
|
||||
#
|
||||
# @return [nil]
|
||||
|
|
|
@ -9,18 +9,10 @@ module Mixin
|
|||
eager_load_recursive(sub_path)
|
||||
end
|
||||
|
||||
# Loads a directory recursively.
|
||||
# The specialty of this method is that it will first load all
|
||||
# files in a directory and then start with the sub directories.
|
||||
# This is needed since otherwise some parent namespaces might not
|
||||
# be initialized yet.
|
||||
#
|
||||
# The cause of this is that Rails autoload doesn't work properly
|
||||
# for same named classes or modules in different namespaces.
|
||||
# Here is a good description how autoload works:
|
||||
# http://urbanautomaton.com/blog/2013/08/27/rails-autoloading-hell/
|
||||
#
|
||||
# This avoids a) Rails autoloading issues and b) require '...' workarounds
|
||||
# Loads a directory recursively. This can be needed when accessing
|
||||
# modules not directly via .constantize on a known string, but dynamically
|
||||
# via the inheritance tree, e.g. via .descendants (which assumes they have
|
||||
# previously been loaded).
|
||||
def self.eager_load_recursive(path)
|
||||
|
||||
excluded = ['.', '..']
|
||||
|
|
|
@ -298,7 +298,7 @@ remove whole data from index
|
|||
query_data = build_query(condition, options)
|
||||
|
||||
if (fields = options.dig(:highlight_fields_by_indexes, index.to_sym))
|
||||
fields_for_highlight = fields.each_with_object({}) { |elem, memo| memo[elem] = {} }
|
||||
fields_for_highlight = fields.index_with { |_elem| {} }
|
||||
|
||||
query_data[:highlight] = { fields: fields_for_highlight }
|
||||
end
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'mixin/rails_logger'
|
||||
require_dependency 'mixin/start_finish_logger'
|
||||
|
||||
class Sequencer
|
||||
include ::Mixin::RailsLogger
|
||||
include ::Mixin::StartFinishLogger
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/mixin/prefixed_constantize'
|
||||
|
||||
class Sequencer
|
||||
class Sequence
|
||||
include ::Mixin::RequiredSubPaths
|
||||
extend ::Sequencer::Mixin::PrefixedConstantize
|
||||
|
||||
PREFIX = 'Sequencer::Sequence::'.freeze
|
||||
|
|
|
@ -9,14 +9,14 @@ class Sequencer
|
|||
def self.sequence
|
||||
[
|
||||
'Import::Zendesk::Ticket::Skip::Deleted',
|
||||
'Import::Zendesk::Ticket::UserID',
|
||||
'Import::Zendesk::Ticket::OwnerID',
|
||||
'Import::Zendesk::Ticket::GroupID',
|
||||
'Import::Zendesk::Ticket::OrganizationID',
|
||||
'Import::Zendesk::Ticket::PriorityID',
|
||||
'Import::Zendesk::Ticket::StateID',
|
||||
'Import::Zendesk::Common::ArticleSenderID',
|
||||
'Import::Zendesk::Common::ArticleTypeID',
|
||||
'Import::Zendesk::Ticket::UserId',
|
||||
'Import::Zendesk::Ticket::OwnerId',
|
||||
'Import::Zendesk::Ticket::GroupId',
|
||||
'Import::Zendesk::Ticket::OrganizationId',
|
||||
'Import::Zendesk::Ticket::PriorityId',
|
||||
'Import::Zendesk::Ticket::StateId',
|
||||
'Import::Zendesk::Common::ArticleSenderId',
|
||||
'Import::Zendesk::Common::ArticleTypeId',
|
||||
'Import::Zendesk::Ticket::Subject',
|
||||
'Import::Zendesk::Ticket::CustomFields',
|
||||
'Import::Zendesk::Ticket::Mapping',
|
||||
|
|
|
@ -9,9 +9,9 @@ class Sequencer
|
|||
|
||||
def self.sequence
|
||||
[
|
||||
'Import::Zendesk::Ticket::Comment::UserID',
|
||||
'Import::Zendesk::Common::ArticleSenderID',
|
||||
'Import::Zendesk::Common::ArticleTypeID',
|
||||
'Import::Zendesk::Ticket::Comment::UserId',
|
||||
'Import::Zendesk::Common::ArticleSenderId',
|
||||
'Import::Zendesk::Common::ArticleTypeId',
|
||||
'Import::Zendesk::Ticket::Comment::From',
|
||||
'Import::Zendesk::Ticket::Comment::To',
|
||||
'Import::Zendesk::Ticket::Comment::Mapping',
|
||||
|
|
|
@ -14,7 +14,7 @@ class Sequencer
|
|||
'Import::Zendesk::User::Login',
|
||||
'Import::Zendesk::User::Password',
|
||||
'Import::Zendesk::User::ImageSource',
|
||||
'Import::Zendesk::User::OrganizationID',
|
||||
'Import::Zendesk::User::OrganizationId',
|
||||
'Common::ModelClass::User',
|
||||
'Import::Zendesk::User::Mapping',
|
||||
'Import::Zendesk::User::CustomFields',
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'mixin/rails_logger'
|
||||
require_dependency 'mixin/start_finish_logger'
|
||||
|
||||
class Sequencer
|
||||
class State
|
||||
include ::Mixin::RailsLogger
|
||||
|
@ -166,7 +163,7 @@ class Sequencer
|
|||
#
|
||||
# @return [Hash{Symbol => Object}]
|
||||
def to_h
|
||||
available.map { |identifier| [identifier, @values[identifier]] }.to_h
|
||||
available.index_with { |identifier| @values[identifier] }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/mixin/prefixed_constantize'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
include ::Mixin::RequiredSubPaths
|
||||
extend ::Sequencer::Mixin::PrefixedConstantize
|
||||
|
||||
PREFIX = 'Sequencer::Unit::'.freeze
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'mixin/rails_logger'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
class Base
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/mixin/handle_failure'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/mixin/handle_failure'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/common/mixin/dynamic_attribute'
|
||||
require_dependency 'sequencer/unit/import/common/model/mixin/log/context_identification_string'
|
||||
|
||||
# This unit checks if an Sequencer state attribute (e.g. `mapped`) is blank.
|
||||
# Don't confuse it with e.g. 'Import::Common::Model::Skip::MissingMandatory::Base' which checks if an attribute key (e.g. mapped[:some_key]) is blank/missing.
|
||||
class Sequencer
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/common/mixin/dynamic_attribute'
|
||||
require_dependency 'sequencer/unit/import/common/model/mixin/log/context_identification_string'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/common'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/common'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -19,7 +19,7 @@ class Sequencer
|
|||
end
|
||||
|
||||
def empty_diff
|
||||
possible_actions.collect { |key| [key, 0] }.to_h
|
||||
possible_actions.index_with { |_key| 0 }
|
||||
end
|
||||
|
||||
def possible_actions
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/common'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -18,8 +18,8 @@ class Sequencer
|
|||
|
||||
def group_ids_access_map
|
||||
@group_ids_access_map ||= begin
|
||||
::Group.all.pluck(:id).each_with_object({}) do |group_id, result|
|
||||
result[group_id] = 'full'.freeze
|
||||
::Group.all.pluck(:id).index_with do
|
||||
'full'.freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/action_diff'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
|
@ -5,7 +5,7 @@ class Sequencer
|
|||
module Import
|
||||
module Ldap
|
||||
module Users
|
||||
class DryRun
|
||||
module DryRun
|
||||
class Payload < Sequencer::Unit::Import::Common::ImportJob::Payload::ToAttribute
|
||||
provides :ldap_config
|
||||
end
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
require_dependency 'sequencer/unit/import/common/model/statistics/mixin/empty_diff'
|
||||
|
||||
class Sequencer
|
||||
class Unit
|
||||
module Import
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue