Maintenance: Activated rubocop rule Layout/ExtraSpacing.
This commit is contained in:
parent
0eedc58558
commit
9d4aff5eb0
65 changed files with 133 additions and 131 deletions
|
@ -139,6 +139,14 @@ Layout/EmptyLinesAroundModuleBody:
|
||||||
Description: "Keeps track of empty lines around module bodies."
|
Description: "Keeps track of empty lines around module bodies."
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/ExtraSpacing:
|
||||||
|
Description: 'Do not use unnecessary spacing.'
|
||||||
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- 'config/routes/**/*'
|
||||||
|
- 'db/migrate/20120101000001_create_base.rb'
|
||||||
|
- 'db/migrate/20120101000010_create_ticket.rb'
|
||||||
|
|
||||||
Style/MultilineBlockChain:
|
Style/MultilineBlockChain:
|
||||||
Description: 'Avoid multi-line chains of blocks.'
|
Description: 'Avoid multi-line chains of blocks.'
|
||||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
||||||
|
|
|
@ -6,12 +6,6 @@
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 163
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
||||||
Layout/ExtraSpacing:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 8
|
||||||
# Configuration parameters: MaximumRangeSize.
|
# Configuration parameters: MaximumRangeSize.
|
||||||
Lint/MissingCopEnableDirective:
|
Lint/MissingCopEnableDirective:
|
||||||
|
|
|
@ -53,9 +53,9 @@ class ChecksKbClientNotificationJob < ApplicationJob
|
||||||
.sessions
|
.sessions
|
||||||
.map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') }
|
.map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') }
|
||||||
.compact
|
.compact
|
||||||
.map { |user_id| User.find_by(id: user_id) }
|
.map { |user_id| User.find_by(id: user_id) }
|
||||||
.compact
|
.compact
|
||||||
.select { |user| user.permissions? "knowledge_base.#{permission_suffix}" }
|
.select { |user| user.permissions? "knowledge_base.#{permission_suffix}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.notify_later(object, event)
|
def self.notify_later(object, event)
|
||||||
|
|
|
@ -12,7 +12,7 @@ class TicketArticleCommunicateEmailJob < ApplicationJob
|
||||||
|
|
||||||
subject_prefix_mode = record.preferences[:subtype]
|
subject_prefix_mode = record.preferences[:subtype]
|
||||||
|
|
||||||
subject = ticket.subject_build(record.subject, subject_prefix_mode)
|
subject = ticket.subject_build(record.subject, subject_prefix_mode)
|
||||||
|
|
||||||
# set retry count
|
# set retry count
|
||||||
record.preferences['delivery_retry'] ||= 0
|
record.preferences['delivery_retry'] ||= 0
|
||||||
|
|
|
@ -163,7 +163,7 @@ returns
|
||||||
|
|
||||||
# do lookup with == to handle case insensitive databases
|
# do lookup with == to handle case insensitive databases
|
||||||
records = if Rails.application.config.db_case_sensitive
|
records = if Rails.application.config.db_case_sensitive
|
||||||
where('LOWER(email) = LOWER(?)', data[:email])
|
where('LOWER(email) = LOWER(?)', data[:email])
|
||||||
else
|
else
|
||||||
where(email: data[:email])
|
where(email: data[:email])
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,8 +48,8 @@ returns
|
||||||
|
|
||||||
def find_and_save_to_cache_by(attr)
|
def find_and_save_to_cache_by(attr)
|
||||||
record = find_by(attr)
|
record = find_by(attr)
|
||||||
return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first) # enforce case-sensitivity on MySQL
|
return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first) # enforce case-sensitivity on MySQL
|
||||||
return record if ActiveRecord::Base.connection.transaction_open? # rollbacks can invalidate cache entries
|
return record if ActiveRecord::Base.connection.transaction_open? # rollbacks can invalidate cache entries
|
||||||
|
|
||||||
cache_set(attr.values.first, record)
|
cache_set(attr.values.first, record)
|
||||||
record
|
record
|
||||||
|
|
|
@ -4,7 +4,7 @@ class EmailAddress < ApplicationModel
|
||||||
include ChecksLatestChangeObserved
|
include ChecksLatestChangeObserved
|
||||||
include HasCollectionUpdate
|
include HasCollectionUpdate
|
||||||
|
|
||||||
has_many :groups, after_add: :cache_update, after_remove: :cache_update
|
has_many :groups, after_add: :cache_update, after_remove: :cache_update
|
||||||
belongs_to :channel, optional: true
|
belongs_to :channel, optional: true
|
||||||
validates :realname, presence: true
|
validates :realname, presence: true
|
||||||
validates :email, presence: true
|
validates :email, presence: true
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
class Karma::Activity < ApplicationModel
|
class Karma::Activity < ApplicationModel
|
||||||
self.table_name = 'karma_activities'
|
self.table_name = 'karma_activities'
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ class KnowledgeBase::Answer < ApplicationModel
|
||||||
AGENT_ALLOWED_ATTRIBUTES = %i[category_id promoted internal_note].freeze
|
AGENT_ALLOWED_ATTRIBUTES = %i[category_id promoted internal_note].freeze
|
||||||
AGENT_ALLOWED_NESTED_RELATIONS = %i[translations].freeze
|
AGENT_ALLOWED_NESTED_RELATIONS = %i[translations].freeze
|
||||||
|
|
||||||
belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :answers, touch: true
|
belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :answers, touch: true
|
||||||
|
|
||||||
scope :include_contents, -> { eager_load(translations: :content) }
|
scope :include_contents, -> { eager_load(translations: :content) }
|
||||||
scope :sorted, -> { order(position: :asc) }
|
scope :sorted, -> { order(position: :asc) }
|
||||||
|
|
|
@ -16,7 +16,7 @@ class KnowledgeBase::Answer::Translation < ApplicationModel
|
||||||
belongs_to :content, class_name: 'KnowledgeBase::Answer::Translation::Content', inverse_of: :translation, dependent: :destroy
|
belongs_to :content, class_name: 'KnowledgeBase::Answer::Translation::Content', inverse_of: :translation, dependent: :destroy
|
||||||
accepts_nested_attributes_for :content, update_only: true
|
accepts_nested_attributes_for :content, update_only: true
|
||||||
|
|
||||||
validates :title, presence: true, length: { maximum: 250 }
|
validates :title, presence: true, length: { maximum: 250 }
|
||||||
validates :content, presence: true
|
validates :content, presence: true
|
||||||
validates :kb_locale_id, uniqueness: { scope: :answer_id }
|
validates :kb_locale_id, uniqueness: { scope: :answer_id }
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ class KnowledgeBase::Category::Translation < ApplicationModel
|
||||||
|
|
||||||
AGENT_ALLOWED_ATTRIBUTES = %i[title kb_locale_id].freeze
|
AGENT_ALLOWED_ATTRIBUTES = %i[title kb_locale_id].freeze
|
||||||
|
|
||||||
belongs_to :kb_locale, class_name: 'KnowledgeBase::Locale', inverse_of: :category_translations
|
belongs_to :kb_locale, class_name: 'KnowledgeBase::Locale', inverse_of: :category_translations
|
||||||
validates :kb_locale, presence: true
|
validates :kb_locale, presence: true
|
||||||
|
|
||||||
belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :translations, touch: true
|
belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :translations, touch: true
|
||||||
|
|
|
@ -50,5 +50,5 @@ class KnowledgeBase::Locale < ApplicationModel
|
||||||
knowledge_base.kb_locales.find_by(primary: true)
|
knowledge_base.kb_locales.find_by(primary: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :available_for, ->(object) { where(id: object.translations.select(:kb_locale_id)) }
|
scope :available_for, ->(object) { where(id: object.translations.select(:kb_locale_id)) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -932,7 +932,7 @@ is certain attribute used by triggers, overviews or schedulers
|
||||||
# fixes issue #2236 - Naming an attribute "attribute" causes ActiveRecord failure
|
# fixes issue #2236 - Naming an attribute "attribute" causes ActiveRecord failure
|
||||||
begin
|
begin
|
||||||
ObjectLookup.by_id(object_lookup_id).constantize.instance_method_already_implemented? name
|
ObjectLookup.by_id(object_lookup_id).constantize.instance_method_already_implemented? name
|
||||||
rescue ActiveRecord::DangerousAttributeError
|
rescue ActiveRecord::DangerousAttributeError
|
||||||
errors.add(:name, "#{name} is a reserved word! (2)")
|
errors.add(:name, "#{name} is a reserved word! (2)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class Report::Profile < ApplicationModel
|
class Report::Profile < ApplicationModel
|
||||||
self.table_name = 'report_profiles'
|
self.table_name = 'report_profiles'
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
store :condition
|
store :condition
|
||||||
|
|
||||||
def self.list
|
def self.list
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Role < ApplicationModel
|
||||||
after_add: :cache_update,
|
after_add: :cache_update,
|
||||||
before_remove: :last_admin_check_by_permission,
|
before_remove: :last_admin_check_by_permission,
|
||||||
after_remove: :cache_update
|
after_remove: :cache_update
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
store :preferences
|
store :preferences
|
||||||
|
|
||||||
before_create :check_default_at_signup_permissions
|
before_create :check_default_at_signup_permissions
|
||||||
|
|
|
@ -176,7 +176,7 @@ reload config settings
|
||||||
|
|
||||||
# convert state into hash to be able to store it as store
|
# convert state into hash to be able to store it as store
|
||||||
def state_check
|
def state_check
|
||||||
return true if state.nil? # allow false value
|
return true if state.nil? # allow false value
|
||||||
return true if state.try(:key?, :value)
|
return true if state.try(:key?, :value)
|
||||||
|
|
||||||
self.state_current = { value: state }
|
self.state_current = { value: state }
|
||||||
|
|
|
@ -405,7 +405,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
|
||||||
col_sep: ',',
|
col_sep: ',',
|
||||||
}
|
}
|
||||||
rows = ::CSV.parse(content, params)
|
rows = ::CSV.parse(content, params)
|
||||||
rows.shift # remove header
|
rows.shift # remove header
|
||||||
|
|
||||||
translation_raw = []
|
translation_raw = []
|
||||||
rows.each do |row|
|
rows.each do |row|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# This file is used by Rack-based servers to start the application.
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
require ::File.expand_path('../config/environment', __FILE__)
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
run Zammad::Application
|
run Zammad::Application
|
||||||
|
|
||||||
# set config to do no self notification
|
# set config to do no self notification
|
||||||
|
|
|
@ -79,7 +79,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.column :pending_time, :timestamp, limit: 3, null: true
|
t.column :pending_time, :timestamp, limit: 3, null: true
|
||||||
t.column :type, :string, limit: 100, null: true
|
t.column :type, :string, limit: 100, null: true
|
||||||
t.column :time_unit, :decimal, precision: 6, scale: 2, null: true
|
t.column :time_unit, :decimal, precision: 6, scale: 2, null: true
|
||||||
t.column :preferences, :text, limit: 500.kilobytes + 1, null: true
|
t.column :preferences, :text, limit: 500.kilobytes + 1, null: true
|
||||||
t.column :updated_by_id, :integer, null: false
|
t.column :updated_by_id, :integer, null: false
|
||||||
t.column :created_by_id, :integer, null: false
|
t.column :created_by_id, :integer, null: false
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
|
@ -185,8 +185,8 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.column :content_type, :string, limit: 20, null: false, default: 'text/plain'
|
t.column :content_type, :string, limit: 20, null: false, default: 'text/plain'
|
||||||
t.column :references, :string, limit: 3200, null: true
|
t.column :references, :string, limit: 3200, null: true
|
||||||
t.column :body, :text, limit: 20.megabytes + 1, null: false
|
t.column :body, :text, limit: 20.megabytes + 1, null: false
|
||||||
t.column :internal, :boolean, null: false, default: false
|
t.column :internal, :boolean, null: false, default: false
|
||||||
t.column :preferences, :text, limit: 500.kilobytes + 1, null: true
|
t.column :preferences, :text, limit: 500.kilobytes + 1, null: true
|
||||||
t.column :updated_by_id, :integer, null: false
|
t.column :updated_by_id, :integer, null: false
|
||||||
t.column :created_by_id, :integer, null: false
|
t.column :created_by_id, :integer, null: false
|
||||||
t.column :origin_by_id, :integer
|
t.column :origin_by_id, :integer
|
||||||
|
@ -212,7 +212,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.column :key, :string, limit: 50, null: false
|
t.column :key, :string, limit: 50, null: false
|
||||||
t.column :value, :string, limit: 50, null: true
|
t.column :value, :string, limit: 50, null: true
|
||||||
t.column :created_by_id, :integer, null: false
|
t.column :created_by_id, :integer, null: false
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
end
|
end
|
||||||
add_index :ticket_article_flags, %i[ticket_article_id created_by_id], name: 'index_ticket_article_flags_on_articles_id_and_created_by_id'
|
add_index :ticket_article_flags, %i[ticket_article_id created_by_id], name: 'index_ticket_article_flags_on_articles_id_and_created_by_id'
|
||||||
add_index :ticket_article_flags, %i[ticket_article_id key]
|
add_index :ticket_article_flags, %i[ticket_article_id key]
|
||||||
|
@ -252,7 +252,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.column :group_direction, :string, limit: 250, null: true
|
t.column :group_direction, :string, limit: 250, null: true
|
||||||
t.column :organization_shared, :boolean, null: false, default: false
|
t.column :organization_shared, :boolean, null: false, default: false
|
||||||
t.column :out_of_office, :boolean, null: false, default: false
|
t.column :out_of_office, :boolean, null: false, default: false
|
||||||
t.column :view, :string, limit: 1000, null: false
|
t.column :view, :string, limit: 1000, null: false
|
||||||
t.column :active, :boolean, null: false, default: true
|
t.column :active, :boolean, null: false, default: true
|
||||||
t.column :updated_by_id, :integer, null: false
|
t.column :updated_by_id, :integer, null: false
|
||||||
t.column :created_by_id, :integer, null: false
|
t.column :created_by_id, :integer, null: false
|
||||||
|
@ -290,7 +290,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
add_foreign_key :overviews_groups, :groups
|
add_foreign_key :overviews_groups, :groups
|
||||||
|
|
||||||
create_table :triggers do |t|
|
create_table :triggers do |t|
|
||||||
t.column :name, :string, limit: 250, null: false
|
t.column :name, :string, limit: 250, null: false
|
||||||
t.column :condition, :text, limit: 500.kilobytes + 1, null: false
|
t.column :condition, :text, limit: 500.kilobytes + 1, null: false
|
||||||
t.column :perform, :text, limit: 500.kilobytes + 1, null: false
|
t.column :perform, :text, limit: 500.kilobytes + 1, null: false
|
||||||
t.column :disable_notification, :boolean, null: false, default: true
|
t.column :disable_notification, :boolean, null: false, default: true
|
||||||
|
@ -349,7 +349,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.column :active, :boolean, null: false, default: true
|
t.column :active, :boolean, null: false, default: true
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
end
|
end
|
||||||
add_index :link_objects, [:name], unique: true
|
add_index :link_objects, [:name], unique: true
|
||||||
|
|
||||||
create_table :links do |t|
|
create_table :links do |t|
|
||||||
t.references :link_type, null: false
|
t.references :link_type, null: false
|
||||||
|
@ -462,11 +462,11 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
add_foreign_key :slas, :users, column: :updated_by_id
|
add_foreign_key :slas, :users, column: :updated_by_id
|
||||||
|
|
||||||
create_table :macros do |t|
|
create_table :macros do |t|
|
||||||
t.string :name, limit: 250, null: true
|
t.string :name, limit: 250, null: true
|
||||||
t.text :perform, limit: 500.kilobytes + 1, null: false
|
t.text :perform, limit: 500.kilobytes + 1, null: false
|
||||||
t.boolean :active, null: false, default: true
|
t.boolean :active, null: false, default: true
|
||||||
t.string :ux_flow_next_up, null: false, default: 'none'
|
t.string :ux_flow_next_up, null: false, default: 'none'
|
||||||
t.string :note, limit: 250, null: true
|
t.string :note, limit: 250, null: true
|
||||||
t.integer :updated_by_id, null: false
|
t.integer :updated_by_id, null: false
|
||||||
t.integer :created_by_id, null: false
|
t.integer :created_by_id, null: false
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
|
@ -476,9 +476,9 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
add_foreign_key :macros, :users, column: :updated_by_id
|
add_foreign_key :macros, :users, column: :updated_by_id
|
||||||
|
|
||||||
create_table :chats do |t|
|
create_table :chats do |t|
|
||||||
t.string :name, limit: 250, null: true
|
t.string :name, limit: 250, null: true
|
||||||
t.integer :max_queue, null: false, default: 5
|
t.integer :max_queue, null: false, default: 5
|
||||||
t.string :note, limit: 250, null: true
|
t.string :note, limit: 250, null: true
|
||||||
t.boolean :active, null: false, default: true
|
t.boolean :active, null: false, default: true
|
||||||
t.boolean :public, null: false, default: false
|
t.boolean :public, null: false, default: false
|
||||||
t.string :block_ip, limit: 5000, null: true
|
t.string :block_ip, limit: 5000, null: true
|
||||||
|
@ -511,7 +511,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
t.string :name, limit: 250, null: true
|
t.string :name, limit: 250, null: true
|
||||||
t.string :state, limit: 50, null: false, default: 'waiting' # running, closed
|
t.string :state, limit: 50, null: false, default: 'waiting' # running, closed
|
||||||
t.references :user, null: true
|
t.references :user, null: true
|
||||||
t.text :preferences, limit: 100.kilobytes + 1, null: true
|
t.text :preferences, limit: 100.kilobytes + 1, null: true
|
||||||
t.integer :updated_by_id, null: true
|
t.integer :updated_by_id, null: true
|
||||||
t.integer :created_by_id, null: true
|
t.integer :created_by_id, null: true
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
|
@ -526,9 +526,9 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
add_foreign_key :chat_sessions, :users, column: :updated_by_id
|
add_foreign_key :chat_sessions, :users, column: :updated_by_id
|
||||||
|
|
||||||
create_table :chat_messages do |t|
|
create_table :chat_messages do |t|
|
||||||
t.references :chat_session, null: false
|
t.references :chat_session, null: false
|
||||||
t.text :content, limit: 20.megabytes + 1, null: false
|
t.text :content, limit: 20.megabytes + 1, null: false
|
||||||
t.integer :created_by_id, null: true
|
t.integer :created_by_id, null: true
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
end
|
end
|
||||||
add_index :chat_messages, [:chat_session_id]
|
add_index :chat_messages, [:chat_session_id]
|
||||||
|
@ -549,7 +549,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
add_foreign_key :chat_agents, :users, column: :updated_by_id
|
add_foreign_key :chat_agents, :users, column: :updated_by_id
|
||||||
|
|
||||||
create_table :report_profiles do |t|
|
create_table :report_profiles do |t|
|
||||||
t.column :name, :string, limit: 150, null: true
|
t.column :name, :string, limit: 150, null: true
|
||||||
t.column :condition, :text, limit: 500.kilobytes + 1, null: true
|
t.column :condition, :text, limit: 500.kilobytes + 1, null: true
|
||||||
t.column :active, :boolean, null: false, default: true
|
t.column :active, :boolean, null: false, default: true
|
||||||
t.column :updated_by_id, :integer, null: false
|
t.column :updated_by_id, :integer, null: false
|
||||||
|
@ -563,7 +563,7 @@ class CreateTicket < ActiveRecord::Migration[4.2]
|
||||||
create_table :karma_users do |t|
|
create_table :karma_users do |t|
|
||||||
t.references :user, null: false
|
t.references :user, null: false
|
||||||
t.integer :score, null: false
|
t.integer :score, null: false
|
||||||
t.string :level, limit: 200, null: false
|
t.string :level, limit: 200, null: false
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
end
|
end
|
||||||
add_index :karma_users, [:user_id], unique: true
|
add_index :karma_users, [:user_id], unique: true
|
||||||
|
|
|
@ -39,12 +39,12 @@ class CreateDoorkeeperTables < ActiveRecord::Migration[4.2]
|
||||||
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
|
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
|
||||||
#
|
#
|
||||||
# t.text :token, null: false
|
# t.text :token, null: false
|
||||||
t.string :token, null: false
|
t.string :token, null: false
|
||||||
|
|
||||||
t.string :refresh_token
|
t.string :refresh_token
|
||||||
t.integer :expires_in
|
t.integer :expires_in
|
||||||
t.datetime :revoked_at
|
t.datetime :revoked_at
|
||||||
t.datetime :created_at, null: false
|
t.datetime :created_at, null: false
|
||||||
t.string :scopes
|
t.string :scopes
|
||||||
|
|
||||||
# If there is a previous_refresh_token column,
|
# If there is a previous_refresh_token column,
|
||||||
|
|
|
@ -14,7 +14,7 @@ class EnhancedPermissions < ActiveRecord::Migration[4.2]
|
||||||
create_table :roles_groups, id: false do |t|
|
create_table :roles_groups, id: false do |t|
|
||||||
t.references :role, null: false
|
t.references :role, null: false
|
||||||
t.references :group, null: false
|
t.references :group, null: false
|
||||||
t.string :access, limit: 50, null: false, default: 'full'
|
t.string :access, limit: 50, null: false, default: 'full'
|
||||||
end
|
end
|
||||||
add_index :roles_groups, [:role_id]
|
add_index :roles_groups, [:role_id]
|
||||||
add_index :roles_groups, [:group_id]
|
add_index :roles_groups, [:group_id]
|
||||||
|
|
|
@ -3,7 +3,7 @@ class NormalizeSettingTicketNumberIgnoreSystemId < ActiveRecord::Migration[5.1]
|
||||||
return if !Setting.find_by(name: 'system_init_done')
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
return if !Setting.exists?(name: 'ticket_number_ignore_system_id')
|
return if !Setting.exists?(name: 'ticket_number_ignore_system_id')
|
||||||
|
|
||||||
Setting.find_by(name: 'ticket_number_ignore_system_id')
|
Setting.find_by(name: 'ticket_number_ignore_system_id')
|
||||||
.update(state_initial: { value: false })
|
.update(state_initial: { value: false })
|
||||||
|
|
||||||
return if Setting.get('ticket_number_ignore_system_id') != { 'ticket_number_ignore_system_id' => false }
|
return if Setting.get('ticket_number_ignore_system_id') != { 'ticket_number_ignore_system_id' => false }
|
||||||
|
|
|
@ -48,7 +48,7 @@ class InitializeKnowledgeBase < ActiveRecord::Migration[5.0]
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table :knowledge_base_category_translations do |t|
|
create_table :knowledge_base_category_translations do |t|
|
||||||
t.string :title, limit: 250, null: false
|
t.string :title, limit: 250, null: false
|
||||||
|
|
||||||
t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales }
|
t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales }
|
||||||
t.references :category, null: false, foreign_key: { to_table: :knowledge_base_categories, on_delete: :cascade }
|
t.references :category, null: false, foreign_key: { to_table: :knowledge_base_categories, on_delete: :cascade }
|
||||||
|
@ -78,7 +78,7 @@ class InitializeKnowledgeBase < ActiveRecord::Migration[5.0]
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table :knowledge_base_answer_translations do |t|
|
create_table :knowledge_base_answer_translations do |t|
|
||||||
t.string :title, limit: 250, null: false
|
t.string :title, limit: 250, null: false
|
||||||
|
|
||||||
t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales }
|
t.references :kb_locale, null: false, foreign_key: { to_table: :knowledge_base_locales }
|
||||||
t.references :answer, null: false, foreign_key: { to_table: :knowledge_base_answers, on_delete: :cascade }
|
t.references :answer, null: false, foreign_key: { to_table: :knowledge_base_answers, on_delete: :cascade }
|
||||||
|
|
|
@ -63,7 +63,7 @@ class SMIMESupport < ActiveRecord::Migration[5.2]
|
||||||
t.datetime :not_after_at, null: true
|
t.datetime :not_after_at, null: true
|
||||||
t.binary :raw, limit: 10.megabytes, null: false
|
t.binary :raw, limit: 10.megabytes, null: false
|
||||||
t.binary :private_key, limit: 10.megabytes, null: true
|
t.binary :private_key, limit: 10.megabytes, null: true
|
||||||
t.string :private_key_secret, limit: 500, null: true
|
t.string :private_key_secret, limit: 500, null: true
|
||||||
t.timestamps limit: 3, null: false
|
t.timestamps limit: 3, null: false
|
||||||
end
|
end
|
||||||
add_index :smime_certificates, [:fingerprint], unique: true
|
add_index :smime_certificates, [:fingerprint], unique: true
|
||||||
|
|
|
@ -53,7 +53,7 @@ module CanBePublished
|
||||||
end
|
end
|
||||||
|
|
||||||
aasm do
|
aasm do
|
||||||
state :draft, initial: true
|
state :draft, initial: true
|
||||||
state :internal
|
state :internal
|
||||||
state :published
|
state :published
|
||||||
state :archived
|
state :archived
|
||||||
|
|
|
@ -20,7 +20,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.find_signature(messages)
|
def self.find_signature(messages)
|
||||||
signature_candidates = Hash.new(0) # <potential_signature>: <score>
|
signature_candidates = Hash.new(0) # <potential_signature>: <score>
|
||||||
messages = messages.map { |m| m[:content_type].match?(%r{text/html}i) ? m[:content].html2text(true) : m[:content] }
|
messages = messages.map { |m| m[:content_type].match?(%r{text/html}i) ? m[:content].html2text(true) : m[:content] }
|
||||||
message_pairs = messages.each_cons(2).to_a
|
message_pairs = messages.each_cons(2).to_a
|
||||||
diffs = message_pairs.map { |msg_pair| Diffy::Diff.new(*msg_pair).to_s }
|
diffs = message_pairs.map { |msg_pair| Diffy::Diff.new(*msg_pair).to_s }
|
||||||
|
|
|
@ -126,7 +126,7 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
# store hash in config
|
# store hash in config
|
||||||
return if !list || !list[0]
|
return if !list || !list[0]
|
||||||
|
|
||||||
file = Store.find(list[0].id)
|
file = Store.find(list[0].id)
|
||||||
filelocation = filename(file)
|
filelocation = filename(file)
|
||||||
|
|
|
@ -324,7 +324,7 @@ returns
|
||||||
# find ticket or create one
|
# find ticket or create one
|
||||||
state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id)
|
state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id)
|
||||||
possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at)
|
possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at)
|
||||||
ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id }
|
ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id }
|
||||||
|
|
||||||
if ticket
|
if ticket
|
||||||
# check if title need to be updated
|
# check if title need to be updated
|
||||||
|
@ -732,7 +732,7 @@ returns
|
||||||
# get the last ticket of customer which is not closed yet, and close it
|
# get the last ticket of customer which is not closed yet, and close it
|
||||||
state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id)
|
state_ids = Ticket::State.where(name: %w[closed merged removed]).pluck(:id)
|
||||||
possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at)
|
possible_tickets = Ticket.where(customer_id: user.id).where.not(state_id: state_ids).order(:updated_at)
|
||||||
ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id }
|
ticket = possible_tickets.find_each.find { |possible_ticket| possible_ticket.preferences[:channel_id] == channel.id }
|
||||||
|
|
||||||
return if !ticket
|
return if !ticket
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ module Zammad
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_version_compatibility
|
def self.check_version_compatibility
|
||||||
return if connection.nil? # Edge case: if Postgres can't find a DB to connect to
|
return if connection.nil? # Edge case: if Postgres can't find a DB to connect to
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,8 @@ module Zammad
|
||||||
class Application
|
class Application
|
||||||
class Initializer
|
class Initializer
|
||||||
module SessionStore
|
module SessionStore
|
||||||
STORE_TYPE = :active_record_store # default: :cookie_store
|
STORE_TYPE = :active_record_store # default: :cookie_store
|
||||||
SESSION_KEY = ('_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s)[5..15]).freeze # default: '_zammad_session'
|
SESSION_KEY = ('_zammad_session_' + Digest::MD5.hexdigest(Rails.root.to_s)[5..15]).freeze # default: '_zammad_session'
|
||||||
|
|
||||||
def self.perform
|
def self.perform
|
||||||
Rails.application.config.session_store STORE_TYPE,
|
Rails.application.config.session_store STORE_TYPE,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
require File.expand_path('../config/boot', __dir__)
|
require File.expand_path('../config/boot', __dir__)
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :job do
|
factory :job do
|
||||||
sequence(:name) { |n| "Test job #{n}" }
|
sequence(:name) { |n| "Test job #{n}" }
|
||||||
condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } }
|
condition { { 'ticket.state_id' => { 'operator' => 'is not', 'value' => 4 } } }
|
||||||
perform { { 'ticket.state_id' => { 'value' => 4 } } }
|
perform { { 'ticket.state_id' => { 'value' => 4 } } }
|
||||||
active { true }
|
active { true }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :postmaster_filter do
|
factory :postmaster_filter do
|
||||||
sequence(:name) { |n| "Test PostmasterFilter #{n}" }
|
sequence(:name) { |n| "Test PostmasterFilter #{n}" }
|
||||||
channel { 'email' }
|
channel { 'email' }
|
||||||
match { { 'from' => { 'operator' => 'contains', 'value' => 'a' } } }
|
match { { 'from' => { 'operator' => 'contains', 'value' => 'a' } } }
|
||||||
perform { { 'x-zammad-ticket-tags' => { 'operator' => 'remove', 'value' => 'test2, test7' } } }
|
perform { { 'x-zammad-ticket-tags' => { 'operator' => 'remove', 'value' => 'test2, test7' } } }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :text_module do
|
factory :text_module do
|
||||||
name { 'text module ' + Faker::Number.unique.number(3) }
|
name { 'text module ' + Faker::Number.unique.number(3) }
|
||||||
keywords { Faker::Superhero.prefix }
|
keywords { Faker::Superhero.prefix }
|
||||||
content { Faker::Lorem.sentence }
|
content { Faker::Lorem.sentence }
|
||||||
updated_by_id { 1 }
|
updated_by_id { 1 }
|
||||||
created_by_id { 1 }
|
created_by_id { 1 }
|
||||||
|
|
|
@ -5,7 +5,7 @@ FactoryBot.define do
|
||||||
priority_name { '2 normal' }
|
priority_name { '2 normal' }
|
||||||
end
|
end
|
||||||
|
|
||||||
association :group, strategy: :create # or else build(:ticket).save fails
|
association :group, strategy: :create # or else build(:ticket).save fails
|
||||||
|
|
||||||
customer
|
customer
|
||||||
title { 'Test Ticket' }
|
title { 'Test Ticket' }
|
||||||
|
|
|
@ -5,7 +5,7 @@ FactoryBot.define do
|
||||||
sender_name { 'Customer' }
|
sender_name { 'Customer' }
|
||||||
end
|
end
|
||||||
|
|
||||||
association :ticket, strategy: :create # or else build(:ticket_article).save fails
|
association :ticket, strategy: :create # or else build(:ticket_article).save fails
|
||||||
from { 'factory-customer-1@example.com' }
|
from { 'factory-customer-1@example.com' }
|
||||||
to { 'factory-customer-1@example.com' }
|
to { 'factory-customer-1@example.com' }
|
||||||
subject { 'factory article' }
|
subject { 'factory article' }
|
||||||
|
@ -28,7 +28,7 @@ FactoryBot.define do
|
||||||
sender_name { 'Agent' }
|
sender_name { 'Agent' }
|
||||||
|
|
||||||
trait :reply do
|
trait :reply do
|
||||||
in_reply_to { Faker::Number.number(19) }
|
in_reply_to { Faker::Number.number(19) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe NotificationFactory::Mailer do
|
||||||
context 'for postmaster oversized mail' do
|
context 'for postmaster oversized mail' do
|
||||||
let(:raw_incoming_mail) { File.read(Rails.root.join('test/data/mail/mail010.box')) }
|
let(:raw_incoming_mail) { File.read(Rails.root.join('test/data/mail/mail010.box')) }
|
||||||
|
|
||||||
let(:parsed_incoming_mail) { Channel::EmailParser.new.parse raw_incoming_mail }
|
let(:parsed_incoming_mail) { Channel::EmailParser.new.parse raw_incoming_mail }
|
||||||
|
|
||||||
let(:incoming_mail) do
|
let(:incoming_mail) do
|
||||||
mail = OpenStruct.new
|
mail = OpenStruct.new
|
||||||
|
|
|
@ -5,7 +5,7 @@ RSpec.describe Sessions::Backend::Base do
|
||||||
|
|
||||||
let(:agent) { create(:agent) }
|
let(:agent) { create(:agent) }
|
||||||
let(:client_id) { '123-1' }
|
let(:client_id) { '123-1' }
|
||||||
let(:ttl) { 3 } # seconds
|
let(:ttl) { 3 } # seconds
|
||||||
let!(:ticket) { Ticket.first || create(:ticket) }
|
let!(:ticket) { Ticket.first || create(:ticket) }
|
||||||
|
|
||||||
describe '#asset_needed?' do
|
describe '#asset_needed?' do
|
||||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe Sessions::Backend::TicketOverviewList do
|
||||||
let(:admin) { create(:admin, groups: [group]) }
|
let(:admin) { create(:admin, groups: [group]) }
|
||||||
let(:group) { create(:group) }
|
let(:group) { create(:group) }
|
||||||
let(:client_id) { '12345' }
|
let(:client_id) { '12345' }
|
||||||
let(:ttl) { 3 } # seconds
|
let(:ttl) { 3 } # seconds
|
||||||
|
|
||||||
context 'when 3rd argument ("client") is false' do
|
context 'when 3rd argument ("client") is false' do
|
||||||
subject(:collection) { described_class.new(admin, {}, false, client_id, ttl) }
|
subject(:collection) { described_class.new(admin, {}, false, client_id, ttl) }
|
||||||
|
|
|
@ -38,7 +38,7 @@ RSpec.shared_examples 'ApplicationModel::CanLookup' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "cache storage by #{attribute}" do
|
describe "cache storage by #{attribute}" do
|
||||||
context 'inside a DB transaction' do # provided by default RSpec config
|
context 'inside a DB transaction' do # provided by default RSpec config
|
||||||
it 'leaves the cache untouched' do
|
it 'leaves the cache untouched' do
|
||||||
expect { described_class.lookup(attribute => instance.send(attribute)) }
|
expect { described_class.lookup(attribute => instance.send(attribute)) }
|
||||||
.not_to change { described_class.cache_get(instance.send(attribute)) }
|
.not_to change { described_class.cache_get(instance.send(attribute)) }
|
||||||
|
|
|
@ -108,7 +108,7 @@ RSpec.describe Calendar, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not create a background job for escalation rebuild' do
|
it 'does not create a background job for escalation rebuild' do
|
||||||
calendar # create and sync (1 inital background job is created)
|
calendar # create and sync (1 inital background job is created)
|
||||||
expect { calendar.sync } # a second sync right after calendar create
|
expect { calendar.sync } # a second sync right after calendar create
|
||||||
.to not_change { Delayed::Job.count }
|
.to not_change { Delayed::Job.count }
|
||||||
end
|
end
|
||||||
|
|
|
@ -921,7 +921,7 @@ RSpec.describe Channel::Driver::Twitter do
|
||||||
tweet_ids.each { |tweet_id| create(:ticket_article, message_id: tweet_id) }
|
tweet_ids.each { |tweet_id| create(:ticket_article, message_id: tweet_id) }
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:tweet_ids) { [1222126386334388225, 1222109934923460608] } # rubocop:disable Style/NumericLiterals
|
let(:tweet_ids) { [1222126386334388225, 1222109934923460608] } # rubocop:disable Style/NumericLiterals
|
||||||
|
|
||||||
it 'does not import duplicates' do
|
it 'does not import duplicates' do
|
||||||
expect { channel.fetch }.not_to change(Ticket::Article, :count)
|
expect { channel.fetch }.not_to change(Ticket::Article, :count)
|
||||||
|
@ -970,7 +970,7 @@ RSpec.describe Channel::Driver::Twitter do
|
||||||
# Run BG job (Why not use Scheduler.worker?
|
# Run BG job (Why not use Scheduler.worker?
|
||||||
# It led to hangs & failures elsewhere in test suite.)
|
# It led to hangs & failures elsewhere in test suite.)
|
||||||
Thread.new do
|
Thread.new do
|
||||||
sleep 5 # simulate other bg jobs holding up the queue
|
sleep 5 # simulate other bg jobs holding up the queue
|
||||||
twitter_job.invoke_job
|
twitter_job.invoke_job
|
||||||
end.tap { example.run }.join
|
end.tap { example.run }.join
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,9 +42,9 @@ RSpec.describe Channel::EmailParser, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#process' do
|
describe '#process' do
|
||||||
let(:raw_mail) { File.read(mail_file) }
|
let(:raw_mail) { File.read(mail_file) }
|
||||||
|
|
||||||
before { Trigger.destroy_all } # triggers may cause additional articles to be created
|
before { Trigger.destroy_all } # triggers may cause additional articles to be created
|
||||||
|
|
||||||
describe 'auto-creating new users' do
|
describe 'auto-creating new users' do
|
||||||
context 'with one unrecognized email address' do
|
context 'with one unrecognized email address' do
|
||||||
|
|
|
@ -91,7 +91,7 @@ RSpec.shared_examples 'HasHistory' do |history_relation_object: nil|
|
||||||
|
|
||||||
describe 'of #owner' do
|
describe 'of #owner' do
|
||||||
let(:attribute) { 'owner' }
|
let(:attribute) { 'owner' }
|
||||||
let(:new_value) { create(:customer) } # Ticket#owner is restricted to active agents of the same group
|
let(:new_value) { create(:customer) } # Ticket#owner is restricted to active agents of the same group
|
||||||
|
|
||||||
include_examples 'failed attribute update' if described_class.attribute_names.include?('owner_id')
|
include_examples 'failed attribute update' if described_class.attribute_names.include?('owner_id')
|
||||||
end
|
end
|
||||||
|
|
|
@ -150,7 +150,7 @@ RSpec.describe Cti::CallerId do
|
||||||
|
|
||||||
context 'and no corresponding CallerId exists' do
|
context 'and no corresponding CallerId exists' do
|
||||||
it 'generates a CallerId record (with #level "known")' do
|
it 'generates a CallerId record (with #level "known")' do
|
||||||
described_class.destroy_all # CallerId already generated in User callback
|
described_class.destroy_all # CallerId already generated in User callback
|
||||||
|
|
||||||
expect { described_class.rebuild }
|
expect { described_class.rebuild }
|
||||||
.to change { described_class.exists?(user_id: user.id, caller_id: '49123456', level: 'known') }
|
.to change { described_class.exists?(user_id: user.id, caller_id: '49123456', level: 'known') }
|
||||||
|
@ -176,7 +176,7 @@ RSpec.describe Cti::CallerId do
|
||||||
let!(:users) { create_list(:agent, 2, phone: '+49 123 456') }
|
let!(:users) { create_list(:agent, 2, phone: '+49 123 456') }
|
||||||
|
|
||||||
it 'generates two corresponding CallerId records (with #level "known")' do
|
it 'generates two corresponding CallerId records (with #level "known")' do
|
||||||
described_class.destroy_all # CallerId already generated in User callback
|
described_class.destroy_all # CallerId already generated in User callback
|
||||||
|
|
||||||
expect { described_class.rebuild }
|
expect { described_class.rebuild }
|
||||||
.to change { described_class.exists?(user_id: users.first.id, caller_id: '49123456', level: 'known') }
|
.to change { described_class.exists?(user_id: users.first.id, caller_id: '49123456', level: 'known') }
|
||||||
|
@ -196,7 +196,7 @@ RSpec.describe Cti::CallerId do
|
||||||
let(:sender_name) { 'Customer' }
|
let(:sender_name) { 'Customer' }
|
||||||
|
|
||||||
it 'generates a CallerId record (with #level "maybe")' do
|
it 'generates a CallerId record (with #level "maybe")' do
|
||||||
described_class.destroy_all # CallerId already generated in Article observer job
|
described_class.destroy_all # CallerId already generated in Article observer job
|
||||||
|
|
||||||
expect { described_class.rebuild }
|
expect { described_class.rebuild }
|
||||||
.to change { described_class.exists?(user_id: article.created_by_id, caller_id: '49123456', level: 'maybe') }
|
.to change { described_class.exists?(user_id: article.created_by_id, caller_id: '49123456', level: 'maybe') }
|
||||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe History, type: :model do
|
||||||
expect(list).to match_array(
|
expect(list).to match_array(
|
||||||
[
|
[
|
||||||
hash_including(
|
hash_including(
|
||||||
'o_id' => object.id,
|
'o_id' => object.id,
|
||||||
),
|
),
|
||||||
hash_including(
|
hash_including(
|
||||||
'o_id' => object.id,
|
'o_id' => object.id,
|
||||||
|
@ -95,7 +95,7 @@ RSpec.describe History, type: :model do
|
||||||
|
|
||||||
context 'with "related_history_object" argument' do
|
context 'with "related_history_object" argument' do
|
||||||
let!(:object) { related_object.ticket }
|
let!(:object) { related_object.ticket }
|
||||||
let!(:related_object) { create(:ticket_article, internal: true) } # MUST be internal, or else callbacks will create additional histories
|
let!(:related_object) { create(:ticket_article, internal: true) } # MUST be internal, or else callbacks will create additional histories
|
||||||
|
|
||||||
before { object.update(title: 'Lorem ipsum dolor') }
|
before { object.update(title: 'Lorem ipsum dolor') }
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ RSpec.describe Job, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates #next_run_at' do
|
it 'updates #next_run_at' do
|
||||||
travel_to(Time.current.last_week) # force new value for #next_run_at
|
travel_to(Time.current.last_week) # force new value for #next_run_at
|
||||||
|
|
||||||
expect { job.run }.to change { job.reload.next_run_at }
|
expect { job.run }.to change { job.reload.next_run_at }
|
||||||
end
|
end
|
||||||
|
@ -194,7 +194,7 @@ RSpec.describe Job, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates #next_run_at' do
|
it 'updates #next_run_at' do
|
||||||
travel_to(Time.current.last_week) # force new value for #next_run_at
|
travel_to(Time.current.last_week) # force new value for #next_run_at
|
||||||
|
|
||||||
expect { job.run }.to change { job.reload.next_run_at }
|
expect { job.run }.to change { job.reload.next_run_at }
|
||||||
end
|
end
|
||||||
|
|
|
@ -145,7 +145,7 @@ RSpec.describe RecentView, type: :model do
|
||||||
let(:owner) { agent }
|
let(:owner) { agent }
|
||||||
|
|
||||||
it 'does not create RecentView for records the given user cannot read' do
|
it 'does not create RecentView for records the given user cannot read' do
|
||||||
ticket.update(owner: User.first, # read access may come from ticket ownership,
|
ticket.update(owner: User.first, # read access may come from ticket ownership,
|
||||||
customer: User.first, # customer status,
|
customer: User.first, # customer status,
|
||||||
organization: nil) # organization's 'shared' status,
|
organization: nil) # organization's 'shared' status,
|
||||||
agent.update(groups: []) # and membership in the Ticket's group
|
agent.update(groups: []) # and membership in the Ticket's group
|
||||||
|
|
|
@ -125,7 +125,7 @@ RSpec.describe Role do
|
||||||
context 'when reactivating a role adds new agents' do
|
context 'when reactivating a role adds new agents' do
|
||||||
subject(:role) { create(:agent_role, active: false) }
|
subject(:role) { create(:agent_role, active: false) }
|
||||||
|
|
||||||
before { create(:user, roles: [role]) }
|
before { create(:user, roles: [role]) }
|
||||||
|
|
||||||
context 'exceeding the system limit' do
|
context 'exceeding the system limit' do
|
||||||
before { Setting.set('system_agent_limit', agents.count) }
|
before { Setting.set('system_agent_limit', agents.count) }
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
||||||
RSpec.describe Ticket::Number do
|
RSpec.describe Ticket::Number do
|
||||||
let(:stubbed_subclass) { double('Foo') }
|
let(:stubbed_subclass) { double('Foo') }
|
||||||
|
|
||||||
before { stub_const('Ticket::Number::Foo', stubbed_subclass) }
|
before { stub_const('Ticket::Number::Foo', stubbed_subclass) }
|
||||||
|
|
||||||
describe '.generate' do
|
describe '.generate' do
|
||||||
before { Setting.set('ticket_number', 'Ticket::Number::Foo') }
|
before { Setting.set('ticket_number', 'Ticket::Number::Foo') }
|
||||||
|
|
|
@ -520,7 +520,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#escalation_at' do
|
describe '#escalation_at' do
|
||||||
before { travel_to(Time.current) } # freeze time
|
before { travel_to(Time.current) } # freeze time
|
||||||
|
|
||||||
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
||||||
let(:calendar) { create(:calendar, :'24/7') }
|
let(:calendar) { create(:calendar, :'24/7') }
|
||||||
|
@ -532,7 +532,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an SLA in the system' do
|
context 'with an SLA in the system' do
|
||||||
before { sla } # create sla
|
before { sla } # create sla
|
||||||
|
|
||||||
it 'is set based on SLA’s #first_response_time' do
|
it 'is set based on SLA’s #first_response_time' do
|
||||||
expect(ticket.reload.escalation_at.to_i)
|
expect(ticket.reload.escalation_at.to_i)
|
||||||
|
@ -540,12 +540,12 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'after first agent’s response' do
|
context 'after first agent’s response' do
|
||||||
before { ticket } # create ticket
|
before { ticket } # create ticket
|
||||||
|
|
||||||
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
||||||
|
|
||||||
it 'is updated based on the SLA’s #update_time' do
|
it 'is updated based on the SLA’s #update_time' do
|
||||||
travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
||||||
|
|
||||||
expect { article }
|
expect { article }
|
||||||
.to change { ticket.reload.escalation_at.to_i }
|
.to change { ticket.reload.escalation_at.to_i }
|
||||||
|
@ -554,7 +554,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
|
|
||||||
context 'when new #update_time is later than original #solution_time' do
|
context 'when new #update_time is later than original #solution_time' do
|
||||||
it 'is updated based on the original #solution_time' do
|
it 'is updated based on the original #solution_time' do
|
||||||
travel(2.hours) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
travel(2.hours) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
||||||
|
|
||||||
expect { article }
|
expect { article }
|
||||||
.to change { ticket.reload.escalation_at.to_i }
|
.to change { ticket.reload.escalation_at.to_i }
|
||||||
|
@ -591,7 +591,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#first_response_escalation_at' do
|
describe '#first_response_escalation_at' do
|
||||||
before { travel_to(Time.current) } # freeze time
|
before { travel_to(Time.current) } # freeze time
|
||||||
|
|
||||||
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
||||||
let(:calendar) { create(:calendar, :'24/7') }
|
let(:calendar) { create(:calendar, :'24/7') }
|
||||||
|
@ -603,7 +603,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an SLA in the system' do
|
context 'with an SLA in the system' do
|
||||||
before { sla } # create sla
|
before { sla } # create sla
|
||||||
|
|
||||||
it 'is set based on SLA’s #first_response_time' do
|
it 'is set based on SLA’s #first_response_time' do
|
||||||
expect(ticket.reload.first_response_escalation_at.to_i)
|
expect(ticket.reload.first_response_escalation_at.to_i)
|
||||||
|
@ -611,7 +611,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'after first agent’s response' do
|
context 'after first agent’s response' do
|
||||||
before { ticket } # create ticket
|
before { ticket } # create ticket
|
||||||
|
|
||||||
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update_escalation_at' do
|
describe '#update_escalation_at' do
|
||||||
before { travel_to(Time.current) } # freeze time
|
before { travel_to(Time.current) } # freeze time
|
||||||
|
|
||||||
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
||||||
let(:calendar) { create(:calendar, :'24/7') }
|
let(:calendar) { create(:calendar, :'24/7') }
|
||||||
|
@ -635,7 +635,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an SLA in the system' do
|
context 'with an SLA in the system' do
|
||||||
before { sla } # create sla
|
before { sla } # create sla
|
||||||
|
|
||||||
it 'is set based on SLA’s #update_time' do
|
it 'is set based on SLA’s #update_time' do
|
||||||
expect(ticket.reload.update_escalation_at.to_i)
|
expect(ticket.reload.update_escalation_at.to_i)
|
||||||
|
@ -643,12 +643,12 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'after first agent’s response' do
|
context 'after first agent’s response' do
|
||||||
before { ticket } # create ticket
|
before { ticket } # create ticket
|
||||||
|
|
||||||
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
||||||
|
|
||||||
it 'is updated based on the SLA’s #update_time' do
|
it 'is updated based on the SLA’s #update_time' do
|
||||||
travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
travel(1.minute) # time is frozen: if we don't travel forward, pre- and post-update values will be the same
|
||||||
|
|
||||||
expect { article }
|
expect { article }
|
||||||
.to change { ticket.reload.update_escalation_at.to_i }
|
.to change { ticket.reload.update_escalation_at.to_i }
|
||||||
|
@ -659,7 +659,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#close_escalation_at' do
|
describe '#close_escalation_at' do
|
||||||
before { travel_to(Time.current) } # freeze time
|
before { travel_to(Time.current) } # freeze time
|
||||||
|
|
||||||
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
let(:sla) { create(:sla, calendar: calendar, first_response_time: 60, update_time: 180, solution_time: 240) }
|
||||||
let(:calendar) { create(:calendar, :'24/7') }
|
let(:calendar) { create(:calendar, :'24/7') }
|
||||||
|
@ -671,7 +671,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an SLA in the system' do
|
context 'with an SLA in the system' do
|
||||||
before { sla } # create sla
|
before { sla } # create sla
|
||||||
|
|
||||||
it 'is set based on SLA’s #solution_time' do
|
it 'is set based on SLA’s #solution_time' do
|
||||||
expect(ticket.reload.close_escalation_at.to_i)
|
expect(ticket.reload.close_escalation_at.to_i)
|
||||||
|
@ -679,7 +679,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'after first agent’s response' do
|
context 'after first agent’s response' do
|
||||||
before { ticket } # create ticket
|
before { ticket } # create ticket
|
||||||
|
|
||||||
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
let(:article) { create(:ticket_article, ticket: ticket, sender_name: 'Agent') }
|
||||||
|
|
||||||
|
@ -878,7 +878,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
|
|
||||||
context 'and subsequently destroyed' do
|
context 'and subsequently destroyed' do
|
||||||
it 'deletes all related attachments' do
|
it 'deletes all related attachments' do
|
||||||
ticket # create ticket
|
ticket # create ticket
|
||||||
|
|
||||||
expect { ticket.destroy }
|
expect { ticket.destroy }
|
||||||
.to change(Store, :count).by(-2)
|
.to change(Store, :count).by(-2)
|
||||||
|
@ -888,7 +888,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and a duplicate ticket is generated from the same email' do
|
context 'and a duplicate ticket is generated from the same email' do
|
||||||
before { ticket } # create ticket
|
before { ticket } # create ticket
|
||||||
|
|
||||||
let(:duplicate) { Channel::EmailParser.new.process({}, raw_email).first }
|
let(:duplicate) { Channel::EmailParser.new.process({}, raw_email).first }
|
||||||
|
|
||||||
|
@ -901,7 +901,7 @@ RSpec.describe Ticket, type: :model do
|
||||||
|
|
||||||
context 'when only the duplicate ticket is destroyed' do
|
context 'when only the duplicate ticket is destroyed' do
|
||||||
it 'deletes only the duplicate attachments' do
|
it 'deletes only the duplicate attachments' do
|
||||||
duplicate # create ticket
|
duplicate # create ticket
|
||||||
|
|
||||||
expect { duplicate.destroy }
|
expect { duplicate.destroy }
|
||||||
.to change(Store, :count).by(-2)
|
.to change(Store, :count).by(-2)
|
||||||
|
|
|
@ -37,8 +37,8 @@ RSpec.describe Trigger, type: :model do
|
||||||
|
|
||||||
describe 'Send-email triggers' do
|
describe 'Send-email triggers' do
|
||||||
before do
|
before do
|
||||||
described_class.destroy_all # Default DB state includes three sample triggers
|
described_class.destroy_all # Default DB state includes three sample triggers
|
||||||
trigger # create subject trigger
|
trigger # create subject trigger
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:perform) do
|
let(:perform) do
|
||||||
|
@ -396,7 +396,7 @@ RSpec.describe Trigger, type: :model do
|
||||||
|
|
||||||
context 'when new article is created directly' do
|
context 'when new article is created directly' do
|
||||||
context 'with empty #preferences hash' do
|
context 'with empty #preferences hash' do
|
||||||
let!(:article) { create(:ticket_article, ticket: ticket) }
|
let!(:article) { create(:ticket_article, ticket: ticket) }
|
||||||
|
|
||||||
it 'fires (without altering ticket state)' do
|
it 'fires (without altering ticket state)' do
|
||||||
expect { Observer::Transaction.commit }
|
expect { Observer::Transaction.commit }
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe Controllers::KnowledgeBase::CategoriesControllerPolicy do
|
||||||
|
|
||||||
describe '#show?' do
|
describe '#show?' do
|
||||||
let(:action_name) { :show }
|
let(:action_name) { :show }
|
||||||
let(:params) { { id: internal_answer.category.id } }
|
let(:params) { { id: internal_answer.category.id } }
|
||||||
|
|
||||||
context 'with knowledge_base.reader permissions' do
|
context 'with knowledge_base.reader permissions' do
|
||||||
let(:user) { create(:agent) }
|
let(:user) { create(:agent) }
|
||||||
|
|
|
@ -35,7 +35,7 @@ RSpec.describe 'Integration SMIME', type: :request do
|
||||||
|
|
||||||
it 'adds certificate by file' do
|
it 'adds certificate by file' do
|
||||||
expect do
|
expect do
|
||||||
post endpoint, params: { file: Rack::Test::UploadedFile.new(certificate_path, 'text/plain', true) }
|
post endpoint, params: { file: Rack::Test::UploadedFile.new(certificate_path, 'text/plain', true) }
|
||||||
end.to change(SMIMECertificate, :count).by(1)
|
end.to change(SMIMECertificate, :count).by(1)
|
||||||
|
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
|
|
|
@ -488,19 +488,19 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
|
||||||
let(:article_communication) do
|
let(:article_communication) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', type_name: 'email', ticket: ticket,
|
sender_name: 'Agent', type_name: 'email', ticket: ticket,
|
||||||
updated_by_id: agent.id, created_by_id: agent.id )
|
updated_by_id: agent.id, created_by_id: agent.id )
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note) do
|
let(:article_note) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
||||||
updated_by_id: agent.id, created_by_id: agent.id )
|
updated_by_id: agent.id, created_by_id: agent.id )
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_customer) do
|
let(:article_note_customer) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Customer', internal: false, type_name: 'note', ticket: ticket,
|
sender_name: 'Customer', internal: false, type_name: 'note', ticket: ticket,
|
||||||
updated_by_id: customer.id, created_by_id: customer.id )
|
updated_by_id: customer.id, created_by_id: customer.id )
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_communication) do
|
let(:article_note_communication) do
|
||||||
|
@ -508,7 +508,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
|
||||||
|
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
||||||
updated_by_id: agent.id, created_by_id: agent.id )
|
updated_by_id: agent.id, created_by_id: agent.id )
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_article_via_rest(article)
|
def delete_article_via_rest(article)
|
||||||
|
|
|
@ -2048,7 +2048,7 @@ RSpec.describe 'Ticket', type: :request do
|
||||||
expect(json_response['tickets']).to eq([ticket1.id, ticket2.id])
|
expect(json_response['tickets']).to eq([ticket1.id, ticket2.id])
|
||||||
|
|
||||||
authenticated_as(admin)
|
authenticated_as(admin)
|
||||||
get "/api/v1/tickets/search?query=#{CGI.escape(title)}&limit=40", params: { sort_by: %w[created_at updated_at], order_by: %w[desc asc] }, as: :json
|
get "/api/v1/tickets/search?query=#{CGI.escape(title)}&limit=40", params: { sort_by: %w[created_at updated_at], order_by: %w[desc asc] }, as: :json
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
expect(json_response).to be_a_kind_of(Hash)
|
expect(json_response).to be_a_kind_of(Hash)
|
||||||
expect(json_response['tickets']).to eq([ticket2.id, ticket1.id])
|
expect(json_response['tickets']).to eq([ticket2.id, ticket1.id])
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
||||||
RSpec.describe 'Login Message', type: :system, authenticated_as: false do
|
RSpec.describe 'Login Message', type: :system, authenticated_as: false do
|
||||||
context 'with maintenance_login_message' do
|
context 'with maintenance_login_message' do
|
||||||
let(:message) { "badum tssss #{rand(99_999)}" }
|
let(:message) { "badum tssss #{rand(99_999)}" }
|
||||||
let(:alt_message) { 'lorem ipsum' }
|
let(:alt_message) { 'lorem ipsum' }
|
||||||
|
|
||||||
before { Setting.set 'maintenance_login_message', message }
|
before { Setting.set 'maintenance_login_message', message }
|
||||||
|
|
||||||
|
|
|
@ -739,7 +739,7 @@ class AdminObjectManagerTest < TestCase
|
||||||
|
|
||||||
# open the previously created ticket and verify its attribute selection
|
# open the previously created ticket and verify its attribute selection
|
||||||
click(
|
click(
|
||||||
xpath: '//a/div[contains(text(),"select_attributes_delete_test")]',
|
xpath: '//a/div[contains(text(),"select_attributes_delete_test")]',
|
||||||
)
|
)
|
||||||
# confirm that all options and their display values are there and are in the correct order
|
# confirm that all options and their display values are there and are in the correct order
|
||||||
select_element = @browser.find_elements(css: '.content.active select[name="select_attributes_delete_test"]')[0]
|
select_element = @browser.find_elements(css: '.content.active select[name="select_attributes_delete_test"]')[0]
|
||||||
|
|
|
@ -246,7 +246,7 @@ class AdminRoleTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
click(
|
click(
|
||||||
css: '.content.active a[href="#manage/users"]',
|
css: '.content.active a[href="#manage/users"]',
|
||||||
)
|
)
|
||||||
|
|
||||||
# an inactive role should not appear in the role filter tabs
|
# an inactive role should not appear in the role filter tabs
|
||||||
|
|
|
@ -129,7 +129,7 @@ class AgentNavigationAndTitleTest < TestCase
|
||||||
exists_not(css: '#navigation .tasks .js-item.is-active')
|
exists_not(css: '#navigation .tasks .js-item.is-active')
|
||||||
|
|
||||||
# click on admin
|
# click on admin
|
||||||
click(css: 'a[href = "#manage"]')
|
click(css: 'a[href = "#manage"]')
|
||||||
verify_title(value: 'Users')
|
verify_title(value: 'Users')
|
||||||
exists_not(css: '#navigation .js-menu .is-active')
|
exists_not(css: '#navigation .js-menu .is-active')
|
||||||
exists_not(css: '#navigation .tasks .js-item.is-active')
|
exists_not(css: '#navigation .tasks .js-item.is-active')
|
||||||
|
|
|
@ -110,7 +110,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
title: 'Welcome to Zammad',
|
title: 'Welcome to Zammad',
|
||||||
)
|
)
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
||||||
)
|
)
|
||||||
|
|
||||||
# enable email full quote in the ticket zoom config page
|
# enable email full quote in the ticket zoom config page
|
||||||
|
@ -186,7 +186,7 @@ class AgentTicketEmailReplyKeepBodyTest < TestCase
|
||||||
title: 'Welcome to Zammad',
|
title: 'Welcome to Zammad',
|
||||||
)
|
)
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
css: '.content.active .js-settingContainer .js-setting .dropdown-icon',
|
||||||
)
|
)
|
||||||
|
|
||||||
# enable email full quote in the ticket zoom config page
|
# enable email full quote in the ticket zoom config page
|
||||||
|
|
|
@ -45,12 +45,12 @@ class AgentTicketOverviewPendingTil < TestCase
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
overview_open(
|
overview_open(
|
||||||
name: name,
|
name: name,
|
||||||
)
|
)
|
||||||
|
|
||||||
# sort by Pending Til
|
# sort by Pending Til
|
||||||
click(
|
click(
|
||||||
css: '.content.active table.table th.js-tableHead[data-column-key="pending_time"]',
|
css: '.content.active table.table th.js-tableHead[data-column-key="pending_time"]',
|
||||||
)
|
)
|
||||||
|
|
||||||
# check if the first and second rows both correctly contain 'pending close'
|
# check if the first and second rows both correctly contain 'pending close'
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ReportingTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
click(
|
click(
|
||||||
css: 'a[href="#manage"]',
|
css: 'a[href="#manage"]',
|
||||||
)
|
)
|
||||||
click(
|
click(
|
||||||
css: '.content.active a[href="#manage/report_profiles"]',
|
css: '.content.active a[href="#manage/report_profiles"]',
|
||||||
|
|
|
@ -8,17 +8,17 @@ class DbAutoIncrementTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
Setting.set('system_init_done', false)
|
Setting.set('system_init_done', false)
|
||||||
|
|
||||||
Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1', updated_by_id: 1, created_by_id: 1 )
|
Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1', updated_by_id: 1, created_by_id: 1 )
|
||||||
state_type = Ticket::StateType.where( name: 'unit test 1' ).first
|
state_type = Ticket::StateType.where( name: 'unit test 1' ).first
|
||||||
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
||||||
assert_equal( 'unit test 1', state_type.name )
|
assert_equal( 'unit test 1', state_type.name )
|
||||||
|
|
||||||
Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1 _ should not be created', updated_by_id: 1, created_by_id: 1 )
|
Ticket::StateType.create_if_not_exists( id: 200, name: 'unit test 1 _ should not be created', updated_by_id: 1, created_by_id: 1 )
|
||||||
state_type = Ticket::StateType.where( id: 200 ).first
|
state_type = Ticket::StateType.where( id: 200 ).first
|
||||||
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
||||||
assert_equal( 'unit test 1', state_type.name )
|
assert_equal( 'unit test 1', state_type.name )
|
||||||
|
|
||||||
Ticket::StateType.create_or_update( id: 200, name: 'unit test 1 _ should be updated', updated_by_id: 1, created_by_id: 1 )
|
Ticket::StateType.create_or_update( id: 200, name: 'unit test 1 _ should be updated', updated_by_id: 1, created_by_id: 1 )
|
||||||
state_type = Ticket::StateType.where( name: 'unit test 1 _ should be updated' ).first
|
state_type = Ticket::StateType.where( name: 'unit test 1 _ should be updated' ).first
|
||||||
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
||||||
assert_equal( 'unit test 1 _ should be updated', state_type.name )
|
assert_equal( 'unit test 1 _ should be updated', state_type.name )
|
||||||
|
@ -27,17 +27,17 @@ class DbAutoIncrementTest < ActiveSupport::TestCase
|
||||||
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
assert_equal( Ticket::StateType.to_s, state_type.class.to_s )
|
||||||
assert_equal( 'unit test 1 _ should be updated', state_type.name )
|
assert_equal( 'unit test 1 _ should be updated', state_type.name )
|
||||||
|
|
||||||
Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
||||||
state = Ticket::State.where( name: 'unit test 1' ).first
|
state = Ticket::State.where( name: 'unit test 1' ).first
|
||||||
assert_equal( Ticket::State.to_s, state.class.to_s )
|
assert_equal( Ticket::State.to_s, state.class.to_s )
|
||||||
assert_equal( 'unit test 1', state.name )
|
assert_equal( 'unit test 1', state.name )
|
||||||
|
|
||||||
Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1 _ should not be created', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
Ticket::State.create_if_not_exists( id: 210, name: 'unit test 1 _ should not be created', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
||||||
state = Ticket::State.where( id: 210 ).first
|
state = Ticket::State.where( id: 210 ).first
|
||||||
assert_equal( Ticket::State.to_s, state.class.to_s )
|
assert_equal( Ticket::State.to_s, state.class.to_s )
|
||||||
assert_equal( 'unit test 1', state.name )
|
assert_equal( 'unit test 1', state.name )
|
||||||
|
|
||||||
Ticket::State.create_or_update( id: 210, name: 'unit test 1 _ should be updated', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
Ticket::State.create_or_update( id: 210, name: 'unit test 1 _ should be updated', state_type_id: Ticket::StateType.where(name: 'unit test 1 _ should be updated').first.id, updated_by_id: 1, created_by_id: 1 )
|
||||||
state = Ticket::State.where( name: 'unit test 1 _ should be updated' ).first
|
state = Ticket::State.where( name: 'unit test 1 _ should be updated' ).first
|
||||||
assert_equal( Ticket::State.to_s, state.class.to_s )
|
assert_equal( Ticket::State.to_s, state.class.to_s )
|
||||||
assert_equal( 'unit test 1 _ should be updated', state.name )
|
assert_equal( 'unit test 1 _ should be updated', state.name )
|
||||||
|
|
|
@ -75,7 +75,7 @@ class StoreTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# sha check
|
# sha check
|
||||||
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
||||||
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
||||||
|
|
||||||
# filename check
|
# filename check
|
||||||
assert_equal(file[:filename], attachments[0].filename)
|
assert_equal(file[:filename], attachments[0].filename)
|
||||||
|
@ -101,7 +101,7 @@ class StoreTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# sha check
|
# sha check
|
||||||
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
||||||
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
||||||
|
|
||||||
# filename check
|
# filename check
|
||||||
assert_equal(file[:filename], attachments[0].filename)
|
assert_equal(file[:filename], attachments[0].filename)
|
||||||
|
@ -128,7 +128,7 @@ class StoreTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# sha check
|
# sha check
|
||||||
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
sha_new = Digest::SHA256.hexdigest(attachments[0].content)
|
||||||
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
assert_equal(sha, sha_new, "check file #{file[:filename]}")
|
||||||
|
|
||||||
# filename check
|
# filename check
|
||||||
assert_equal(file[:filename], attachments[0].filename)
|
assert_equal(file[:filename], attachments[0].filename)
|
||||||
|
|
Loading…
Reference in a new issue