diff --git a/app/assets/javascripts/app/controllers/network.coffee b/app/assets/javascripts/app/controllers/network.coffee
deleted file mode 100644
index e0c165635..000000000
--- a/app/assets/javascripts/app/controllers/network.coffee
+++ /dev/null
@@ -1,67 +0,0 @@
-class Index extends App.ControllerContent
- events:
- 'click [data-type=network-new]': 'network_new'
- 'click [data-type=network-edit]': 'network_edit'
- 'click [data-type=network-destroy]': 'network_destroy'
- 'click [data-type=network-category-new]': 'network_category_new'
- 'click [data-type=network-category-edit]': 'network_category_edit'
- 'click [data-type=network-category-destroy]': 'network_category_destroy'
-
- constructor: ->
- super
-
- # set title
- @title 'Network'
- @render()
- @navupdate '#network'
-
- render: ->
- networks = App.Network.all()
- network_categories = App.NetworkCategory.all()
- for network in networks
- @log 'notice', network for network in networks
-
- for network_category in network_categories
- @log 'notice', network_category
-
- @html App.view('network')(
- networks: App.Network.all(),
- )
-
- network_new: (e) ->
- e.preventDefault()
- new App.ControllerGenericNewWindow(
- pageData: {
- object: 'Network',
- },
- genericObject: App.Network,
- success: =>
- @render()
- )
-
- network_edit: (e) ->
- e.preventDefault()
- @id = $(e.target).parents('[data-id]').data('id')
- new App.ControllerGenericEditWindow(
- id: @id,
- pageData: {
- object: 'Network',
- },
- genericObject: App.Network,
- success: =>
- @render()
- )
-
- network_destroy: (e) ->
- e.preventDefault()
- id = $(e.target).parents('[data-id]').data('id')
- item = App.Network.find(id)
- item.destroy() if confirm('Sure?')
- @render()
-
-App.Config.set( 'network', Index, 'Routes' )
-
-#App.Config.set( 'Network', { prio: 1500, parent: '', name: 'Networking', target: '#network', role: ['Anybody', 'Customer', 'Agent'] }, 'NavBar' ), 'NavBar' )
-#App.Config.set( '', { prio: 1600, parent: '', name: 'anybody+agent', target: '#aa', role: ['Anybody', 'Agent'] }
-#App.Config.set( '', { prio: 1600, parent: '', name: 'Anybody', target: '#anybody', role: ['Anybody'] }
-
diff --git a/app/assets/javascripts/app/models/network.coffee b/app/assets/javascripts/app/models/network.coffee
deleted file mode 100644
index 17140fdb9..000000000
--- a/app/assets/javascripts/app/models/network.coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-class App.Network extends App.Model
- @configure 'Network', 'name', 'note', 'active', 'updated_at'
- @extend Spine.Model.Ajax
- @configure_attributes = [
- { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false },
- { name: 'note', display: 'Note', note: 'Notes are visible to agents only, never to customers.', tag: 'textarea', limit: 250, null: true },
- { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
- { name: 'active', display: 'Active', tag: 'active', default: true },
- ]
diff --git a/app/assets/javascripts/app/models/network_category.coffee b/app/assets/javascripts/app/models/network_category.coffee
deleted file mode 100644
index 2fef16be8..000000000
--- a/app/assets/javascripts/app/models/network_category.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-class App.NetworkCategory extends App.Model
- @configure 'NetworkCategory', 'name', 'network_id', 'network_category_type_id', 'network_privacy_id', 'note', 'allow_comments', 'active', 'updated_at'
- @extend Spine.Model.Ajax
diff --git a/app/assets/javascripts/app/models/network_category_type.coffee b/app/assets/javascripts/app/models/network_category_type.coffee
deleted file mode 100644
index 12ba541a6..000000000
--- a/app/assets/javascripts/app/models/network_category_type.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-class App.NetworkCategoryType extends App.Model
- @configure 'NetworkCategoryType', 'name', 'note', 'active', 'updated_at'
- @extend Spine.Model.Ajax
diff --git a/app/assets/javascripts/app/models/network_privacy.coffee b/app/assets/javascripts/app/models/network_privacy.coffee
deleted file mode 100644
index 1bf9a3590..000000000
--- a/app/assets/javascripts/app/models/network_privacy.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-class App.NetworkPrivacy extends App.Model
- @configure 'NetworkPrivacy', 'name', 'key', 'updated_at'
- @extend Spine.Model.Ajax
diff --git a/app/assets/javascripts/app/views/network.jst.eco b/app/assets/javascripts/app/views/network.jst.eco
deleted file mode 100644
index fb1ee677b..000000000
--- a/app/assets/javascripts/app/views/network.jst.eco
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-<% for network in @networks: %>
-
-<% end %>
-
-
-
-
-
-
-
-
-
Activity Stream
-
- - New XXX
- - New XXX
- - New XXX
- - New XXX
-
-
-
-
-
-
diff --git a/app/controllers/application_controller/renders_models.rb b/app/controllers/application_controller/renders_models.rb
index d58932667..bedadcb79 100644
--- a/app/controllers/application_controller/renders_models.rb
+++ b/app/controllers/application_controller/renders_models.rb
@@ -41,7 +41,7 @@ module ApplicationController::RendersModels
generic_object.with_lock do
# set attributes
- generic_object.update_attributes!(clean_params)
+ generic_object.update!(clean_params)
# set relations
generic_object.associations_from_param(params)
diff --git a/app/controllers/applications_controller.rb b/app/controllers/applications_controller.rb
index 69dcbf2f4..fd1744156 100644
--- a/app/controllers/applications_controller.rb
+++ b/app/controllers/applications_controller.rb
@@ -45,7 +45,7 @@ class ApplicationsController < ApplicationController
def update
application = Doorkeeper::Application.find(params[:id])
- application.update_attributes!(clean_params)
+ application.update!(clean_params)
render json: application, status: :ok
end
diff --git a/app/controllers/channels_email_controller.rb b/app/controllers/channels_email_controller.rb
index 4de117b14..4f3b1ccec 100644
--- a/app/controllers/channels_email_controller.rb
+++ b/app/controllers/channels_email_controller.rb
@@ -124,7 +124,7 @@ class ChannelsEmailController < ApplicationController
# update account
if channel_id
channel = Channel.find(channel_id)
- channel.update_attributes(
+ channel.update!(
options: {
inbound: params[:inbound].to_h,
outbound: params[:outbound].to_h,
@@ -163,7 +163,7 @@ class ChannelsEmailController < ApplicationController
end
if address
- address.update_attributes(
+ address.update!(
realname: params[:meta][:realname],
email: email,
active: true,
diff --git a/app/controllers/integration/exchange_controller.rb b/app/controllers/integration/exchange_controller.rb
index 74d7f178c..cdb3fa427 100644
--- a/app/controllers/integration/exchange_controller.rb
+++ b/app/controllers/integration/exchange_controller.rb
@@ -13,7 +13,7 @@ class Integration::ExchangeController < ApplicationController
)
{
- endpoint: client.autodiscover.ews_url,
+ endpoint: client.try(:autodiscover).try(:ews_url),
}
end
end
diff --git a/app/controllers/network_controller.rb b/app/controllers/network_controller.rb
deleted file mode 100644
index 5a7dd1a47..000000000
--- a/app/controllers/network_controller.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
-
-class NetworksController < ApplicationController
- prepend_before_action :authentication_check
-
- # GET /networks
- # GET /networks.json
- def index
- @networks = Network.all
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @networks }
- end
- end
-
- # GET /networks/1
- # GET /networks/1.json
- def show
- @network = Network.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @network }
- end
- end
-
- # GET /networks/new
- # GET /networks/new.json
- def new
- @network = Network.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @network }
- end
- end
-
- # GET /networks/1/edit
- def edit
- @network = Network.find(params[:id])
- end
-
- # POST /networks
- # POST /networks.json
- def create
- @network = Network.new(params[:network])
-
- respond_to do |format|
- if @network.save
- format.html { redirect_to @network, notice: 'Network was successfully created.' }
- format.json { render json: @network, status: :created }
- else
- format.html { render action: 'new' }
- format.json { render json: @network.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # PUT /networks/1
- # PUT /networks/1.json
- def update
- @network = Network.find(params[:id])
-
- respond_to do |format|
- if @network.update_attributes(params[:network])
- format.html { redirect_to @network, notice: 'Network was successfully updated.' }
- format.json { render json: @network, status: :ok }
- else
- format.html { render action: 'edit' }
- format.json { render json: @network.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /networks/1
- # DELETE /networks/1.json
- def destroy
- @network = Network.find(params[:id])
- @network.destroy
-
- respond_to do |format|
- format.html { redirect_to networks_url }
- format.json { head :ok }
- end
- end
-end
diff --git a/app/controllers/sessions/collection_network.rb b/app/controllers/sessions/collection_network.rb
deleted file mode 100644
index 6ac868b64..000000000
--- a/app/controllers/sessions/collection_network.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
-
-module ExtraCollection
- def session( collections, assets, _user )
-
- collections[ Network.to_app_model ] = Network.all
- collections[ Network::Category.to_app_model ] = Network::Category.all
- collections[ Network::Category::Type.to_app_model ] = Network::Category::Type.all
- collections[ Network::Privacy.to_app_model ] = Network::Privacy.all
- [collections, assets]
- end
-
- module_function :session
-end
diff --git a/app/controllers/ticket_articles_controller.rb b/app/controllers/ticket_articles_controller.rb
index 43cb987f1..baa28649b 100644
--- a/app/controllers/ticket_articles_controller.rb
+++ b/app/controllers/ticket_articles_controller.rb
@@ -111,7 +111,7 @@ class TicketArticlesController < ApplicationController
clean_params = Ticket::Article.association_name_to_id_convert(params)
clean_params = Ticket::Article.param_cleanup(clean_params, true)
- article.update_attributes!(clean_params)
+ article.update!(clean_params)
if params[:expand]
result = article.attributes_with_association_names
diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb
index 043878288..fd5c73ee3 100644
--- a/app/controllers/tickets_controller.rb
+++ b/app/controllers/tickets_controller.rb
@@ -192,7 +192,7 @@ class TicketsController < ApplicationController
end
ticket.with_lock do
- ticket.update_attributes!(clean_params)
+ ticket.update!(clean_params)
if params[:article]
article_create(ticket, params[:article])
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index ff2a98185..92e289b6b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -253,7 +253,7 @@ class UsersController < ApplicationController
user.with_lock do
clean_params = User.association_name_to_id_convert(params)
clean_params = User.param_cleanup(clean_params, true)
- user.update_attributes(clean_params)
+ user.update!(clean_params)
# only allow Admin's
if current_user.permissions?('admin.user') && (params[:role_ids] || params[:roles])
@@ -765,7 +765,7 @@ curl http://localhost/api/v1/users/password_change -v -u #{login}:#{password} -H
return
end
- user.update_attributes(password: params[:password_new])
+ user.update!(password: params[:password_new])
NotificationFactory::Mailer.notification(
template: 'password_change',
@@ -980,7 +980,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
# update user link
user = User.find(current_user.id)
- user.update_attributes(image: avatar.store_hash)
+ user.update!(image: avatar.store_hash)
render json: { avatar: avatar }, status: :ok
end
@@ -996,7 +996,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
# update user link
user = User.find(current_user.id)
- user.update_attributes(image: avatar.store_hash)
+ user.update!(image: avatar.store_hash)
render json: {}, status: :ok
end
@@ -1013,7 +1013,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
# update user link
avatar = Avatar.get_default('User', current_user.id)
user = User.find(current_user.id)
- user.update_attributes(image: avatar.store_hash)
+ user.update!(image: avatar.store_hash)
render json: {}, status: :ok
end
diff --git a/app/models/application_model/can_creates_and_updates.rb b/app/models/application_model/can_creates_and_updates.rb
index 45fabaa1b..1f0bf2557 100644
--- a/app/models/application_model/can_creates_and_updates.rb
+++ b/app/models/application_model/can_creates_and_updates.rb
@@ -119,7 +119,7 @@ returns
if data[:id]
record = find_by(id: data[:id])
if record
- record.update_attributes(data)
+ record.update!(data)
return record
end
record = new(data)
@@ -135,7 +135,7 @@ returns
end
records.each { |loop_record|
if loop_record.name == data[:name]
- loop_record.update_attributes(data)
+ loop_record.update!(data)
return loop_record
end
}
@@ -152,7 +152,7 @@ returns
end
records.each { |loop_record|
if loop_record.login.casecmp(data[:login]).zero?
- loop_record.update_attributes(data)
+ loop_record.update!(data)
return loop_record
end
}
@@ -169,7 +169,7 @@ returns
end
records.each { |loop_record|
if loop_record.email.casecmp(data[:email]).zero?
- loop_record.update_attributes(data)
+ loop_record.update!(data)
return loop_record
end
}
@@ -186,7 +186,7 @@ returns
end
records.each { |loop_record|
if loop_record.locale.casecmp(data[:locale]).zero?
- loop_record.update_attributes(data)
+ loop_record.update!(data)
return loop_record
end
}
diff --git a/app/models/authorization.rb b/app/models/authorization.rb
index 771f4d2f5..6ae251654 100644
--- a/app/models/authorization.rb
+++ b/app/models/authorization.rb
@@ -14,14 +14,14 @@ class Authorization < ApplicationModel
if auth
# update auth tokens
- auth.update_attributes(
+ auth.update!(
token: hash['credentials']['token'],
secret: hash['credentials']['secret']
)
# update username of auth entry if empty
if !auth.username && hash['info']['nickname']
- auth.update_attributes(
+ auth.update!(
username: hash['info']['nickname'],
)
end
diff --git a/app/models/avatar.rb b/app/models/avatar.rb
index 6ea423f41..cb4159e09 100644
--- a/app/models/avatar.rb
+++ b/app/models/avatar.rb
@@ -211,7 +211,7 @@ add avatar by url
# update existing
if avatar_already_exists
- avatar_already_exists.update_attributes(record)
+ avatar_already_exists.update!(record)
avatar = avatar_already_exists
# add new one and set it as default
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
index 1ac32dc09..6324e278c 100644
--- a/app/models/calendar.rb
+++ b/app/models/calendar.rb
@@ -47,7 +47,7 @@ returns calendar object
# find if auto generated calendar exists
calendar = Calendar.find_by(default: true, updated_by_id: 1, created_by_id: 1)
if calendar
- calendar.update_attributes(calendar_details)
+ calendar.update!(calendar_details)
return calendar
end
create(calendar_details)
diff --git a/app/models/channel/filter/identify_sender.rb b/app/models/channel/filter/identify_sender.rb
index e408ab10e..99a98bfae 100644
--- a/app/models/channel/filter/identify_sender.rb
+++ b/app/models/channel/filter/identify_sender.rb
@@ -141,7 +141,7 @@ module Channel::Filter::IdentifySender
if user.firstname.blank? && user.lastname.blank?
if data[:firstname].present?
data[:firstname] = cleanup_name(data[:firstname])
- user.update_attributes(
+ user.update!(
firstname: data[:firstname]
)
end
@@ -166,7 +166,7 @@ module Channel::Filter::IdentifySender
data[:created_by_id] = 1
user = User.create(data)
- user.update_attributes(
+ user.update!(
updated_by_id: user.id,
created_by_id: user.id,
)
diff --git a/app/models/chat/agent.rb b/app/models/chat/agent.rb
index fe3002bcb..99ea9be48 100644
--- a/app/models/chat/agent.rb
+++ b/app/models/chat/agent.rb
@@ -34,7 +34,7 @@ class Chat::Agent < ApplicationModel
updated_by_id: params[:updated_by_id]
)
if chat_agent
- chat_agent.update_attributes(params)
+ chat_agent.update!(params)
else
Chat::Agent.create(params)
end
diff --git a/app/models/email_address.rb b/app/models/email_address.rb
index 3c9985d30..59dee0acd 100644
--- a/app/models/email_address.rb
+++ b/app/models/email_address.rb
@@ -69,7 +69,7 @@ check and if channel not exists reset configured channels for email addresses
# delete group.email_address_id reference if email address get's deleted
def delete_group_reference
Group.where(email_address_id: id).each { |group|
- group.update_attributes!(email_address_id: nil)
+ group.update!(email_address_id: nil)
}
end
diff --git a/app/models/history.rb b/app/models/history.rb
index 80ef771c6..74a9bf6ef 100644
--- a/app/models/history.rb
+++ b/app/models/history.rb
@@ -73,7 +73,7 @@ add a new history entry for an object
history_record = History.find_by(id: data[:id])
end
if history_record
- history_record.update_attributes(record)
+ history_record.update!(record)
else
record_new = History.create(record)
if record[:id]
diff --git a/app/models/locale.rb b/app/models/locale.rb
index 969c51729..854fd75ce 100644
--- a/app/models/locale.rb
+++ b/app/models/locale.rb
@@ -117,9 +117,9 @@ all:
data.each { |locale|
exists = Locale.find_by(locale: locale['locale'])
if exists
- exists.update(locale.symbolize_keys!)
+ exists.update!(locale.symbolize_keys!)
else
- Locale.create(locale.symbolize_keys!)
+ Locale.create!(locale.symbolize_keys!)
end
}
end
diff --git a/app/models/network.rb b/app/models/network.rb
deleted file mode 100644
index e1d054f95..000000000
--- a/app/models/network.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
-
-class Network < ApplicationModel
- # belongs_to :group
- # belongs_to :state, :class_name => 'Ticket::State'
- # belongs_to :priority, :class_name => 'Ticket::Priority'
-
- class Category < ApplicationModel
- self.table_name = 'network_categories'
-
- class Type < ApplicationModel
- end
-
- class Subscription < ApplicationModel
- end
- end
-
- class Item < ApplicationModel
- class Comment < ApplicationModel
- end
-
- class Plus < ApplicationModel
- self.table_name = 'network_item_plus'
- end
-
- class Subscription < ApplicationModel
- end
- end
-
- class Privacy < ApplicationModel
- self.table_name = 'network_privacies'
- end
-end
diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb
index 22581ba9c..844fe5f84 100644
--- a/app/models/scheduler.rb
+++ b/app/models/scheduler.rb
@@ -169,7 +169,7 @@ class Scheduler < ApplicationModel
end
def self._start_job(job, try_count = 0, try_run_time = Time.zone.now)
- job.update(
+ job.update!(
last_run: Time.zone.now,
pid: Thread.current.object_id,
status: 'ok',
@@ -205,7 +205,7 @@ class Scheduler < ApplicationModel
error = "Failed to run #{job.method} after #{try_count} tries #{e.inspect}"
logger.error error
- job.update(
+ job.update!(
error_message: error,
status: 'error',
active: false,
@@ -285,7 +285,7 @@ class Scheduler < ApplicationModel
# return [true]
def self.restart_failed_jobs
failed_jobs.each do |job|
- job.update(active: true)
+ job.update!(active: true)
end
true
diff --git a/app/models/text_module.rb b/app/models/text_module.rb
index 7fcb7da83..b006d459b 100644
--- a/app/models/text_module.rb
+++ b/app/models/text_module.rb
@@ -38,7 +38,7 @@ load text modules from online
exists = TextModule.find_by(foreign_id: text_module['foreign_id'])
if exists
next if !overwrite_existing_item
- exists.update(text_module.symbolize_keys!)
+ exists.update!(text_module.symbolize_keys!)
else
text_module[:updated_by_id] = 1
text_module[:created_by_id] = 1
diff --git a/app/models/translation.rb b/app/models/translation.rb
index 9f536b32d..3cea271b7 100644
--- a/app/models/translation.rb
+++ b/app/models/translation.rb
@@ -371,7 +371,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
end
}
if update_needed
- translation.update_attributes(translation_raw.symbolize_keys!)
+ translation.update!(translation_raw.symbolize_keys!)
translation.save
end
else
diff --git a/app/models/user.rb b/app/models/user.rb
index d56a76fab..8cdbc49a3 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -610,7 +610,7 @@ returns
return if !user
# reset password
- user.update_attributes(password: password)
+ user.update!(password: password)
# delete token
Token.find_by(action: 'PasswordReset', name: token).destroy
@@ -689,7 +689,7 @@ returns
return if user && local_user.id != user.id
# set verified
- local_user.update_attributes(verified: true)
+ local_user.update!(verified: true)
# delete token
Token.find_by(action: 'Signup', name: token).destroy
diff --git a/config/routes/network.rb b/config/routes/network.rb
deleted file mode 100644
index f3b6ecd7f..000000000
--- a/config/routes/network.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-Zammad::Application.routes.draw do
- api_path = Rails.configuration.api_path
-
- # networkss
- match api_path + '/networks', to: 'networks#index', via: :get
- match api_path + '/networks/:id', to: 'networks#show', via: :get
- match api_path + '/networks', to: 'networks#create', via: :post
- match api_path + '/networks/:id', to: 'networks#update', via: :put
- match api_path + '/networks/:id', to: 'networks#destroy', via: :delete
-
-end
diff --git a/db/migrate/20120101000020_create_network.rb b/db/migrate/20120101000020_create_network.rb
deleted file mode 100644
index aaa1fde0d..000000000
--- a/db/migrate/20120101000020_create_network.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-class CreateNetwork < ActiveRecord::Migration[4.2]
- def up
- create_table :networks do |t|
- t.column :name, :string, limit: 100, null: false
- t.column :note, :string, limit: 250, null: true
- t.column :active, :boolean, null: false, default: true
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :networks, [:name], unique: true
-
- create_table :network_category_types do |t|
- t.column :name, :string, limit: 100, null: false
- t.column :note, :string, limit: 250, null: true
- t.column :active, :boolean, null: false, default: true
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_category_types, [:name], unique: true
-
- create_table :network_privacies do |t|
- t.column :name, :string, limit: 100, null: false
- t.column :key, :string, limit: 250, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_privacies, [:name], unique: true
-
- create_table :network_categories do |t|
- t.references :network_category_type, null: false
- t.references :network_privacy, null: false
- t.references :network, null: false
- t.column :name, :string, limit: 200, null: false
- t.column :note, :string, limit: 250, null: true
- t.column :allow_comments, :boolean, null: false, default: true
- t.column :active, :boolean, null: false, default: true
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_categories, [:network_id]
-
- create_table :network_categories_moderator_users, id: false do |t|
- t.integer :user_id
- t.integer :network_category_id
- end
-
- create_table :network_items do |t|
- t.references :network_category, null: false
- t.column :title, :string, limit: 200, null: false
- t.column :body, :string, limit: 20_000, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps null: false
- end
- add_index :network_items, [:network_category_id]
-
- create_table :network_item_comments do |t|
- t.references :network_item, null: false
- t.column :body, :string, limit: 20_000, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_item_comments, [:network_item_id]
-
- create_table :network_item_plus do |t|
- t.references :network_item, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_item_plus, [:network_item_id, :created_by_id], unique: true
-
- create_table :network_category_subscriptions do |t|
- t.references :network_categories, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_category_subscriptions, [:network_categories_id, :created_by_id], unique: true, name: 'index_network_category_subscriptions_on_network_c_i_and_c'
-
- create_table :network_item_subscriptions do |t|
- t.references :network_item, null: false
- t.column :updated_by_id, :integer, null: false
- t.column :created_by_id, :integer, null: false
- t.timestamps limit: 3, null: false
- end
- add_index :network_item_subscriptions, [:network_item_id, :created_by_id], unique: true, name: 'index_network_item_subscriptions_on_item_id_and_created_by_id'
-
- end
-
- def down
- drop_table :network_item_subscriptions
- drop_table :network_category_subscriptions
- drop_table :network_categories_moderator_users
- drop_table :network_item_plus
- drop_table :network_item_comments
- drop_table :network_items
- drop_table :network_categories
- drop_table :network_privacies
- drop_table :network_category_types
- drop_table :networks
- end
-end
diff --git a/db/migrate/20170912123300_remove_network.rb b/db/migrate/20170912123300_remove_network.rb
new file mode 100644
index 000000000..1671760f2
--- /dev/null
+++ b/db/migrate/20170912123300_remove_network.rb
@@ -0,0 +1,18 @@
+class RemoveNetwork < ActiveRecord::Migration
+
+ # rewinds db/migrate/20120101000020_create_network.rb
+ def change
+ return if !ActiveRecord::Base.connection.table_exists? 'networks'
+
+ drop_table :networks
+ drop_table :network_category_types
+ drop_table :network_privacies
+ drop_table :network_categories
+ drop_table :network_categories_moderator_users
+ drop_table :network_items
+ drop_table :network_item_comments
+ drop_table :network_item_plus
+ drop_table :network_category_subscriptions
+ drop_table :network_item_subscriptions
+ end
+end
diff --git a/db/seeds.rb b/db/seeds.rb
index 885aa4407..2623896cc 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -13,7 +13,7 @@ Cache.clear
# this is the __ordered__ list of seed files
# extend only if needed - try to add your changes
# to the matching one of the existing files
-seeds = %w(settings user_nr_1 signatures roles permissions groups links ticket_state_types ticket_states ticket_priorities ticket_article_types ticket_article_senders macros community_user_resources overviews channels report_profiles chats networks object_manager_attributes schedulers triggers karma_activities)
+seeds = %w(settings user_nr_1 signatures roles permissions groups links ticket_state_types ticket_states ticket_priorities ticket_article_types ticket_article_senders macros community_user_resources overviews channels report_profiles chats object_manager_attributes schedulers triggers karma_activities)
# loop and require all seedfiles
# files will get executed automatically
diff --git a/db/seeds/networks.rb b/db/seeds/networks.rb
deleted file mode 100644
index 4da71d606..000000000
--- a/db/seeds/networks.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-network = Network.create_if_not_exists(
- id: 1,
- name: 'base',
-)
-
-Network::Category::Type.create_if_not_exists(
- id: 1,
- name: 'Announcement',
-)
-Network::Category::Type.create_if_not_exists(
- id: 2,
- name: 'Idea',
-)
-Network::Category::Type.create_if_not_exists(
- id: 3,
- name: 'Question',
-)
-Network::Category::Type.create_if_not_exists(
- id: 4,
- name: 'Bug Report',
-)
-
-Network::Privacy.create_if_not_exists(
- id: 1,
- name: 'logged in',
- key: 'loggedIn',
-)
-Network::Privacy.create_if_not_exists(
- id: 2,
- name: 'logged in and moderator',
- key: 'loggedInModerator',
-)
-Network::Category.create_if_not_exists(
- id: 1,
- name: 'Announcements',
- network_id: network.id,
- network_category_type_id: Network::Category::Type.find_by(name: 'Announcement').id,
- network_privacy_id: Network::Privacy.find_by(name: 'logged in and moderator').id,
- allow_comments: true,
-)
-Network::Category.create_if_not_exists(
- id: 2,
- name: 'Questions',
- network_id: network.id,
- allow_comments: true,
- network_category_type_id: Network::Category::Type.find_by(name: 'Question').id,
- network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
-)
-Network::Category.create_if_not_exists(
- id: 3,
- name: 'Ideas',
- network_id: network.id,
- network_category_type_id: Network::Category::Type.find_by(name: 'Idea').id,
- network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
- allow_comments: true,
-)
-Network::Category.create_if_not_exists(
- id: 4,
- name: 'Bug Reports',
- network_id: network.id,
- network_category_type_id: Network::Category::Type.find_by(name: 'Bug Report').id,
- network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
- allow_comments: true,
-)
-item = Network::Item.create(
- title: 'Example Announcement',
- body: 'Some announcement....',
- network_category_id: Network::Category.find_by(name: 'Announcements').id,
-)
-Network::Item::Comment.create(
- network_item_id: item.id,
- body: 'Some comment....',
-)
-item = Network::Item.create(
- title: 'Example Question?',
- body: 'Some questions....',
- network_category_id: Network::Category.find_by(name: 'Questions').id,
-)
-Network::Item::Comment.create(
- network_item_id: item.id,
- body: 'Some comment....',
-)
-item = Network::Item.create(
- title: 'Example Idea',
- body: 'Some idea....',
- network_category_id: Network::Category.find_by(name: 'Ideas').id,
-)
-Network::Item::Comment.create(
- network_item_id: item.id,
- body: 'Some comment....',
-)
-item = Network::Item.create(
- title: 'Example Bug Report',
- body: 'Some bug....',
- network_category_id: Network::Category.find_by(name: 'Bug Reports').id,
-)
-Network::Item::Comment.create(
- network_item_id: item.id,
- body: 'Some comment....',
-)
diff --git a/lib/facebook.rb b/lib/facebook.rb
index 46f03291d..4be668974 100644
--- a/lib/facebook.rb
+++ b/lib/facebook.rb
@@ -147,7 +147,7 @@ result
next if !new_value || new_value.empty?
user_data[target] = new_value
}
- user.update_attributes(user_data)
+ user.update!(user_data)
else
user_data[:login] = item_user['id']
if item_user['first_name'] && item_user['last_name']
diff --git a/lib/import/integration_base.rb b/lib/import/integration_base.rb
index ac995f9dd..45fad7193 100644
--- a/lib/import/integration_base.rb
+++ b/lib/import/integration_base.rb
@@ -135,9 +135,9 @@ module Import
end
def inform(message)
- @import_job.update_attribute(:result, {
- info: message
- })
+ @import_job.update!(result: {
+ info: message
+ })
end
end
end
diff --git a/lib/import/ldap/user.rb b/lib/import/ldap/user.rb
index 19eaba32f..e5c607a32 100644
--- a/lib/import/ldap/user.rb
+++ b/lib/import/ldap/user.rb
@@ -29,7 +29,7 @@ module Import
# the active state this way to send notifications
# to the client
::User.where(id: slice).each do |user|
- user.update_attribute(:active, false)
+ user.update!(active: false)
end
end
end
diff --git a/lib/import/otrs/article.rb b/lib/import/otrs/article.rb
index a50c7669c..bd8db5c03 100644
--- a/lib/import/otrs/article.rb
+++ b/lib/import/otrs/article.rb
@@ -53,7 +53,7 @@ module Import
@local_article = ::Ticket::Article.find_by(id: article[:id])
return false if !@local_article
log "update Ticket::Article.find_by(id: #{article[:id]})"
- @local_article.update_attributes(article)
+ @local_article.update!(article)
true
end
diff --git a/lib/import/otrs/customer.rb b/lib/import/otrs/customer.rb
index 9a3d31e1a..ef4c4d8c6 100644
--- a/lib/import/otrs/customer.rb
+++ b/lib/import/otrs/customer.rb
@@ -44,7 +44,7 @@ module Import
@local_customer = Organization.find_by(name: customer[:name])
return false if !@local_customer
log "update Organization.find_by(name: #{customer[:name]})"
- @local_customer.update_attributes(customer)
+ @local_customer.update!(customer)
true
end
diff --git a/lib/import/otrs/customer_user.rb b/lib/import/otrs/customer_user.rb
index 47b9b5e47..6e12bb4b6 100644
--- a/lib/import/otrs/customer_user.rb
+++ b/lib/import/otrs/customer_user.rb
@@ -52,7 +52,7 @@ module Import
end
log "update User.find_by(login: #{customer[:login]})"
- @local_customer.update_attributes(customer)
+ @local_customer.update!(customer)
true
end
diff --git a/lib/import/otrs/priority.rb b/lib/import/otrs/priority.rb
index 8882a7ad9..784964003 100644
--- a/lib/import/otrs/priority.rb
+++ b/lib/import/otrs/priority.rb
@@ -33,7 +33,7 @@ module Import
@local_priority = ::Ticket::Priority.find_by(id: priority[:id])
return false if !@local_priority
log "update Ticket::Priority.find_by(id: #{priority[:id]})"
- @local_priority.update_attributes(priority)
+ @local_priority.update!(priority)
true
end
diff --git a/lib/import/otrs/queue.rb b/lib/import/otrs/queue.rb
index a00e4531a..2ccfe99ce 100644
--- a/lib/import/otrs/queue.rb
+++ b/lib/import/otrs/queue.rb
@@ -33,7 +33,7 @@ module Import
@local_queue = Group.find_by(id: queue[:id])
return false if !@local_queue
log "update Group.find_by(id: #{queue[:id]})"
- @local_queue.update_attributes(queue)
+ @local_queue.update!(queue)
true
end
diff --git a/lib/import/otrs/state.rb b/lib/import/otrs/state.rb
index 3841e441e..416654b3f 100644
--- a/lib/import/otrs/state.rb
+++ b/lib/import/otrs/state.rb
@@ -34,7 +34,7 @@ module Import
@local_state = ::Ticket::State.find_by(id: state[:id])
return false if !@local_state
log "update Ticket::State.find_by(id: #{state[:id]})"
- @local_state.update_attributes(state)
+ @local_state.update!(state)
true
end
diff --git a/lib/import/otrs/ticket.rb b/lib/import/otrs/ticket.rb
index 4c40666ca..3c17fecef 100644
--- a/lib/import/otrs/ticket.rb
+++ b/lib/import/otrs/ticket.rb
@@ -50,7 +50,7 @@ module Import
@local_ticket = ::Ticket.find_by(id: ticket[:id])
return false if !@local_ticket
log "update Ticket.find_by(id: #{ticket[:id]})"
- @local_ticket.update_attributes(ticket)
+ @local_ticket.update!(ticket)
true
end
diff --git a/lib/import/otrs/user.rb b/lib/import/otrs/user.rb
index 19291eb1c..e1d40fd43 100644
--- a/lib/import/otrs/user.rb
+++ b/lib/import/otrs/user.rb
@@ -43,7 +43,7 @@ module Import
end
log "update User.find_by(id: #{user[:id]})"
- @local_user.update_attributes(user)
+ @local_user.update!(user)
true
end
diff --git a/lib/import/zendesk/ticket.rb b/lib/import/zendesk/ticket.rb
index 615e32ffe..7a18c0079 100644
--- a/lib/import/zendesk/ticket.rb
+++ b/lib/import/zendesk/ticket.rb
@@ -25,7 +25,7 @@ module Import
def updated?(ticket)
@local_ticket = ::Ticket.find_by(id: ticket[:id])
return false if !@local_ticket
- @local_ticket.update_attributes(ticket)
+ @local_ticket.update!(ticket)
true
end
diff --git a/lib/import/zendesk/ticket/comment.rb b/lib/import/zendesk/ticket/comment.rb
index d6a2f3fff..996920d56 100644
--- a/lib/import/zendesk/ticket/comment.rb
+++ b/lib/import/zendesk/ticket/comment.rb
@@ -19,7 +19,7 @@ module Import
def updated?(article)
@local_article = ::Ticket::Article.find_by(message_id: article[:message_id])
return false if !@local_article
- @local_article.update_attributes(article)
+ @local_article.update!(article)
true
end
diff --git a/lib/telegram.rb b/lib/telegram.rb
index ac4ac15fe..1ecddcb1f 100644
--- a/lib/telegram.rb
+++ b/lib/telegram.rb
@@ -243,7 +243,7 @@ returns
}
if auth
user = User.find(auth.user_id)
- user.update_attributes(user_data)
+ user.update!(user_data)
else
if message_user[:username]
user_data[:note] = "Telegram @#{message_user[:username]}"
@@ -261,7 +261,7 @@ returns
provider: 'telegram'
}
if auth
- auth.update_attributes(auth_data)
+ auth.update!(auth_data)
else
Authorization.create(auth_data)
end
diff --git a/lib/tweet_base.rb b/lib/tweet_base.rb
index 00f8c693b..ccee60fb7 100644
--- a/lib/tweet_base.rb
+++ b/lib/tweet_base.rb
@@ -52,7 +52,7 @@ class TweetBase
next if !new_value || new_value.empty?
user_data[target] = new_value
}
- user.update_attributes(user_data)
+ user.update!(user_data)
else
user_data[:login] = tweet_user.screen_name
user_data[:firstname] = tweet_user.name
@@ -91,7 +91,7 @@ class TweetBase
provider: 'twitter'
}
if auth
- auth.update_attributes(auth_data)
+ auth.update!(auth_data)
else
Authorization.create!(auth_data)
end
diff --git a/spec/lib/import/base_resource_spec.rb b/spec/lib/import/base_resource_spec.rb
index 8b5321321..6bbe77404 100644
--- a/spec/lib/import/base_resource_spec.rb
+++ b/spec/lib/import/base_resource_spec.rb
@@ -121,8 +121,8 @@ RSpec.describe Import::BaseResource do
old_signature = create(:signature)
old_users = create_list(:user, 2)
- group.update_attribute(:signature_id, old_signature.id)
- group.update_attribute(:user_ids, old_users.collect(&:id))
+ group.update!(signature_id: old_signature.id)
+ group.update!(user_ids: old_users.collect(&:id))
# simulate next import run
travel 20.minutes
diff --git a/spec/lib/import/ldap/user_spec.rb b/spec/lib/import/ldap/user_spec.rb
index 14e76c5bd..6fe2ea46c 100644
--- a/spec/lib/import/ldap/user_spec.rb
+++ b/spec/lib/import/ldap/user_spec.rb
@@ -245,7 +245,7 @@ RSpec.describe Import::Ldap::User do
it "doesn't detect false changes" do
# make sure that the nothing has changed
- User.find_by(login: uid).update_attribute(:email, 'example@example.com')
+ User.find_by(login: uid).update!(email: 'example@example.com')
expect_any_instance_of(User).not_to receive(:save!)
instance = described_class.new(user_entry, ldap_config, user_roles, signup_role_ids)
diff --git a/spec/lib/import/otrs/article_spec.rb b/spec/lib/import/otrs/article_spec.rb
index 7ad1d137d..9b300f92b 100644
--- a/spec/lib/import/otrs/article_spec.rb
+++ b/spec/lib/import/otrs/article_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Article do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/customer_spec.rb b/spec/lib/import/otrs/customer_spec.rb
index ca16752f7..a39e66d03 100644
--- a/spec/lib/import/otrs/customer_spec.rb
+++ b/spec/lib/import/otrs/customer_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe Import::OTRS::Customer do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/customer_user_spec.rb b/spec/lib/import/otrs/customer_user_spec.rb
index 086540800..c3a24c0a9 100644
--- a/spec/lib/import/otrs/customer_user_spec.rb
+++ b/spec/lib/import/otrs/customer_user_spec.rb
@@ -15,9 +15,9 @@ RSpec.describe Import::OTRS::CustomerUser do
expect(import_object).to receive(:find_by).and_return(existing_object)
# we delete the :role_ids from the zammad_structure to make sure that
# a) role_ids call returns the initial role_ids
- # b) and update_attributes gets called without them
+ # b) and update! gets called without them
expect(existing_object).to receive(:role_ids).and_return(zammad_structure.delete(:role_ids)).at_least(:once)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/priority_spec.rb b/spec/lib/import/otrs/priority_spec.rb
index c7c5a3f6e..a17a75de4 100644
--- a/spec/lib/import/otrs/priority_spec.rb
+++ b/spec/lib/import/otrs/priority_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Priority do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/queue_spec.rb b/spec/lib/import/otrs/queue_spec.rb
index 4b0621ee9..7b25179d9 100644
--- a/spec/lib/import/otrs/queue_spec.rb
+++ b/spec/lib/import/otrs/queue_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Queue do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/state_spec.rb b/spec/lib/import/otrs/state_spec.rb
index 5e13ba04f..4347cfd99 100644
--- a/spec/lib/import/otrs/state_spec.rb
+++ b/spec/lib/import/otrs/state_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Import::OTRS::State do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/ticket_spec.rb b/spec/lib/import/otrs/ticket_spec.rb
index 389aaaef1..504f856ab 100644
--- a/spec/lib/import/otrs/ticket_spec.rb
+++ b/spec/lib/import/otrs/ticket_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Ticket do
def updates_with(zammad_structure)
expect(import_object).to receive(:find_by).and_return(existing_object)
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/otrs/user_spec.rb b/spec/lib/import/otrs/user_spec.rb
index 3802b844f..fc7deb35c 100644
--- a/spec/lib/import/otrs/user_spec.rb
+++ b/spec/lib/import/otrs/user_spec.rb
@@ -14,9 +14,9 @@ RSpec.describe Import::OTRS::User do
expect(import_object).to receive(:find_by).and_return(existing_object)
# we delete the :role_ids from the zammad_structure to make sure that
# a) role_ids call returns the initial role_ids
- # b) and update_attributes gets called without them
+ # b) and update! gets called without them
expect(existing_object).to receive(:role_ids).and_return(zammad_structure.delete(:role_ids))
- expect(existing_object).to receive(:update_attributes).with(zammad_structure)
+ expect(existing_object).to receive(:update!).with(zammad_structure)
expect(import_object).not_to receive(:new)
start_import_test
end
diff --git a/spec/lib/import/zendesk/ticket/comment_spec.rb b/spec/lib/import/zendesk/ticket/comment_spec.rb
index 8b49efe8a..354f057d4 100644
--- a/spec/lib/import/zendesk/ticket/comment_spec.rb
+++ b/spec/lib/import/zendesk/ticket/comment_spec.rb
@@ -88,7 +88,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -186,7 +186,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -282,7 +282,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -373,7 +373,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -461,7 +461,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -544,7 +544,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
@@ -626,7 +626,7 @@ RSpec.describe Import::Zendesk::Ticket::Comment do
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
local_article = double()
- expect(local_article).to receive(:update_attributes).with(update_structure)
+ expect(local_article).to receive(:update!).with(update_structure)
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
diff --git a/spec/lib/import/zendesk/ticket_spec.rb b/spec/lib/import/zendesk/ticket_spec.rb
index 1a62722f7..3ffaec04b 100644
--- a/spec/lib/import/zendesk/ticket_spec.rb
+++ b/spec/lib/import/zendesk/ticket_spec.rb
@@ -122,7 +122,7 @@ RSpec.describe Import::Zendesk::Ticket do
expect(Import::Zendesk::Ticket::CommentFactory).to receive(:import).with(ticket.comments, local_ticket, ticket)
expect(::Ticket).to receive(:find_by).with(id: expected_structure[:id]).and_return(local_ticket)
- expect(local_ticket).to receive(:update_attributes).with(expected_structure)
+ expect(local_ticket).to receive(:update!).with(expected_structure)
created_instance = described_class.new(ticket)
end
diff --git a/spec/lib/ldap_rspec.rb b/spec/lib/ldap_spec.rb
similarity index 99%
rename from spec/lib/ldap_rspec.rb
rename to spec/lib/ldap_spec.rb
index e3cd1dacf..bd43e70d3 100644
--- a/spec/lib/ldap_rspec.rb
+++ b/spec/lib/ldap_spec.rb
@@ -279,7 +279,7 @@ RSpec.describe Ldap do
expect(mocked_ldap).to receive(:search).with(include(expected)).and_yield(yield_entry).and_return(true)
check_entry = nil
- instancesearch(filter, additional) { |entry| check_entry = entry }
+ instance.search(filter, additional) { |entry| check_entry = entry }
expect(check_entry).to eq(yield_entry)
end
diff --git a/spec/models/concerns/has_groups_examples.rb b/spec/models/concerns/has_groups_examples.rb
index 4a91dec86..96b93af21 100644
--- a/spec/models/concerns/has_groups_examples.rb
+++ b/spec/models/concerns/has_groups_examples.rb
@@ -4,7 +4,7 @@ RSpec.shared_examples 'HasGroups' do
context 'group' do
let(:group_access_instance_inactive) {
- group_access_instance.update_attribute(:active, false)
+ group_access_instance.update!(active: false)
group_access_instance
}
let(:group_full) { create(:group) }
diff --git a/spec/models/concerns/has_roles_examples.rb b/spec/models/concerns/has_roles_examples.rb
index c591c317b..a17f2b73d 100644
--- a/spec/models/concerns/has_roles_examples.rb
+++ b/spec/models/concerns/has_roles_examples.rb
@@ -5,7 +5,7 @@ RSpec.shared_examples 'HasRoles' do
context 'role' do
let(:group_access_instance_inactive) {
- group_access_instance.update_attribute(:active, false)
+ group_access_instance.update!(active: false)
group_access_instance
}
let(:role) { create(:role) }
diff --git a/spec/models/import_job_spec.rb b/spec/models/import_job_spec.rb
index adb6d1a88..2a5670cc1 100644
--- a/spec/models/import_job_spec.rb
+++ b/spec/models/import_job_spec.rb
@@ -221,7 +221,7 @@ RSpec.describe ImportJob do
instance = create(:import_job)
delayed_job = double()
- instance.update_attribute(:finished_at, Time.zone.now)
+ instance.update!(finished_at: Time.zone.now)
expect(instance.reschedule?(delayed_job)).to be false
end
diff --git a/spec/models/scheduler_spec.rb b/spec/models/scheduler_spec.rb
index 67412c29d..78c820cec 100644
--- a/spec/models/scheduler_spec.rb
+++ b/spec/models/scheduler_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe Scheduler do
# lock job (simluates interrupted scheduler task)
locked_job = Delayed::Job.last
- locked_job.update_attribute(:locked_at, Time.zone.now)
+ locked_job.update!(locked_at: Time.zone.now)
expect do
simulate_threads_call
@@ -134,7 +134,7 @@ RSpec.describe Scheduler do
# lock job (simluates interrupted scheduler task)
locked_job = Delayed::Job.last
- locked_job.update_attribute(:locked_at, Time.zone.now)
+ locked_job.update!(locked_at: Time.zone.now)
expect do
simulate_threads_call
@@ -151,7 +151,7 @@ RSpec.describe Scheduler do
# lock job (simluates interrupted scheduler task)
locked_job = Delayed::Job.last
- locked_job.update_attribute(:locked_at, Time.zone.now)
+ locked_job.update!(locked_at: Time.zone.now)
expect do
simulate_threads_call
diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb
index f90bf2029..0dee7dee3 100644
--- a/spec/models/ticket_spec.rb
+++ b/spec/models/ticket_spec.rb
@@ -213,14 +213,14 @@ RSpec.describe Ticket do
pending_time: Time.zone.now + 2.days)
expect(ticket.pending_time).not_to be nil
- ticket.update_attribute(:state, Ticket::State.lookup(name: 'open'))
+ ticket.update!(state: Ticket::State.lookup(name: 'open'))
expect(ticket.pending_time).to be nil
end
it 'lets handle ActiveRecord nil as new value' do
ticket = create(:ticket)
expect do
- ticket.update_attribute(:state, nil)
+ ticket.update!(state: nil)
end.to raise_error(ActiveRecord::StatementInvalid)
end
diff --git a/test/integration/clearbit_test.rb b/test/integration/clearbit_test.rb
index 82ef6bad5..a8d867070 100644
--- a/test/integration/clearbit_test.rb
+++ b/test/integration/clearbit_test.rb
@@ -93,7 +93,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert_equal('OTRS is an Open Source helpdesk software and an IT Service Management software free of licence costs. Improve your Customer Service Management with OTRS.', organization2_lookup.note)
# update with own values (do not overwrite)
- customer2.update_attributes(
+ customer2.update!(
firstname: 'Martini',
note: 'changed by my self',
)
@@ -122,7 +122,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert_equal('Norsk-Data-Straße 1, 61352 Bad Homburg vor der Höhe, Germany', customer2_lookup.address)
# update with own values (do not overwrite)
- customer2.update_attributes(
+ customer2.update!(
firstname: '',
note: 'changed by my self',
)
@@ -139,7 +139,7 @@ class ClearbitTest < ActiveSupport::TestCase
assert_equal('Norsk-Data-Straße 1, 61352 Bad Homburg vor der Höhe, Germany', customer2_lookup.address)
# update with changed values at clearbit site (do overwrite)
- customer2.update_attributes(
+ customer2.update!(
email: 'me2@example.com',
)
diff --git a/test/integration/email_deliver_test.rb b/test/integration/email_deliver_test.rb
index 7fa409897..bb5f48251 100644
--- a/test/integration/email_deliver_test.rb
+++ b/test/integration/email_deliver_test.rb
@@ -91,7 +91,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
assert_nil(article1_lookup.preferences['delivery_status_message'])
# send with invalid smtp settings
- channel.update_attributes(
+ channel.update!(
options: {
inbound: {
adapter: 'imap',
@@ -125,7 +125,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
assert(article1_lookup.preferences['delivery_status_message'])
# send with correct smtp settings
- channel.update_attributes(
+ channel.update!(
options: {
inbound: {
adapter: 'imap',
@@ -162,7 +162,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
Delayed::Job.destroy_all
# send with invalid smtp settings
- channel.update_attributes(
+ channel.update!(
options: {
inbound: {
adapter: 'imap',
diff --git a/test/integration/report_test.rb b/test/integration/report_test.rb
index 90b52a714..af1164ae8 100644
--- a/test/integration/report_test.rb
+++ b/test/integration/report_test.rb
@@ -66,7 +66,7 @@ class ReportTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
- @ticket1.update_attributes(
+ @ticket1.update!(
group: Group.lookup(name: 'Users'),
updated_at: '2015-10-28 14:30:00 UTC',
)
@@ -97,7 +97,7 @@ class ReportTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
- @ticket2.update_attributes(
+ @ticket2.update!(
group_id: group2.id,
updated_at: '2015-10-28 14:30:00 UTC',
)
@@ -184,7 +184,7 @@ class ReportTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
- @ticket5.update_attributes(
+ @ticket5.update!(
state: Ticket::State.lookup(name: 'open'),
updated_at: '2015-10-28 14:30:00 UTC',
)
diff --git a/test/unit/activity_stream_test.rb b/test/unit/activity_stream_test.rb
index 8da295f33..01110299e 100644
--- a/test/unit/activity_stream_test.rb
+++ b/test/unit/activity_stream_test.rb
@@ -47,7 +47,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
)
travel 100.seconds
- ticket.update_attributes(
+ ticket.update!(
title: 'Unit Test 1 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'open').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -55,7 +55,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
updated_at = ticket.updated_at
travel 1.second
- ticket.update_attributes(
+ ticket.update!(
title: 'Unit Test 2 (äöüß) - update!',
priority_id: Ticket::Priority.lookup(name: '2 normal').id,
)
@@ -99,11 +99,11 @@ class ActivityStreamTest < ActiveSupport::TestCase
travel 100.seconds
assert_equal(organization.class, Organization)
- organization.update_attributes(name: 'some name (äöüß)')
+ organization.update!(name: 'some name (äöüß)')
updated_at = organization.updated_at
travel 10.seconds
- organization.update_attributes(name: 'some name 2 (äöüß)')
+ organization.update!(name: 'some name 2 (äöüß)')
# check activity_stream
stream = @admin_user.activity_stream(3)
@@ -138,7 +138,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
created_by_id: @current_user.id,
)
assert_equal(user.class, User)
- user.update_attributes(
+ user.update!(
firstname: 'Bob U',
lastname: 'Smith U',
)
@@ -172,14 +172,14 @@ class ActivityStreamTest < ActiveSupport::TestCase
travel 100.seconds
assert_equal(user.class, User)
- user.update_attributes(
+ user.update!(
firstname: 'Bob U',
lastname: 'Smith U',
)
updated_at = user.updated_at
travel 10.seconds
- user.update_attributes(
+ user.update!(
firstname: 'Bob',
lastname: 'Smith',
)
diff --git a/test/unit/auth_test.rb b/test/unit/auth_test.rb
index f0b2b6a85..ffcd46e8d 100644
--- a/test/unit/auth_test.rb
+++ b/test/unit/auth_test.rb
@@ -5,7 +5,7 @@ class AuthTest < ActiveSupport::TestCase
test 'auth' do
user = User.find_by(email: 'nicole.braun@zammad.org')
- user.update_attributes(
+ user.update!(
login: 'nicole.braun',
firstname: 'Nicole',
lastname: 'Braun',
diff --git a/test/unit/email_process_follow_up_possible_test.rb b/test/unit/email_process_follow_up_possible_test.rb
index cf8def07d..32529ceaf 100644
--- a/test/unit/email_process_follow_up_possible_test.rb
+++ b/test/unit/email_process_follow_up_possible_test.rb
@@ -36,7 +36,7 @@ Subject: #{ticket.subject_build('some new subject')}
Some Text"
- users_group.update_attribute('follow_up_possible', 'new_ticket')
+ users_group.update!('follow_up_possible' => 'new_ticket')
travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, follow_up_raw)
@@ -60,7 +60,7 @@ Some Text"
assert_equal('some new subject2', ticket_p.title)
assert_equal('some new subject2', article_p.subject)
- users_group.update_attribute('follow_up_possible', 'yes')
+ users_group.update!('follow_up_possible' => 'yes')
travel 1.second
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, follow_up_raw)
diff --git a/test/unit/history_test.rb b/test/unit/history_test.rb
index 989b92152..b3ab587d1 100644
--- a/test/unit/history_test.rb
+++ b/test/unit/history_test.rb
@@ -164,10 +164,10 @@ class HistoryTest < ActiveSupport::TestCase
# update ticket
if test[:ticket_update][:ticket]
- ticket.update_attributes(test[:ticket_update][:ticket])
+ ticket.update!(test[:ticket_update][:ticket])
end
if test[:ticket_update][:article]
- article.update_attributes(test[:ticket_update][:article])
+ article.update!(test[:ticket_update][:article])
end
end
@@ -260,7 +260,7 @@ class HistoryTest < ActiveSupport::TestCase
# update user
if test[:user_update][:user]
test[:user_update][:user][:active] = false
- user.update_attributes(test[:user_update][:user])
+ user.update!(test[:user_update][:user])
end
end
@@ -323,7 +323,7 @@ class HistoryTest < ActiveSupport::TestCase
# update organization
if test[:organization_update][:organization]
- organization.update_attributes(test[:organization_update][:organization])
+ organization.update!(test[:organization_update][:organization])
end
end
diff --git a/test/unit/online_notifiaction_test.rb b/test/unit/online_notifiaction_test.rb
index f30c37588..8c2710266 100644
--- a/test/unit/online_notifiaction_test.rb
+++ b/test/unit/online_notifiaction_test.rb
@@ -78,7 +78,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket1.id, 'create', @agent_user1, false))
assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket1.id, 'create', @agent_user1, true))
- ticket1.update_attributes(
+ ticket1.update!(
title: 'Unit Test 1 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'open').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -133,7 +133,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket2.id, 'create', @customer_user, false))
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket2.id, 'create', @customer_user, true))
- ticket2.update_attributes(
+ ticket2.update!(
title: 'Unit Test 1 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'open').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -187,7 +187,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'create', @agent_user1, false))
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'create', @agent_user1, true))
- ticket3.update_attributes(
+ ticket3.update!(
title: 'Unit Test 2 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'closed').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -267,7 +267,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket4.id, 'create', @customer_user, false))
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket4.id, 'create', @customer_user, true))
- ticket4.update_attributes(
+ ticket4.update!(
title: 'Unit Test 3 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'open').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -321,7 +321,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket5.id, 'create', @agent_user1, false))
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket5.id, 'create', @agent_user1, true))
- ticket5.update_attributes(
+ ticket5.update!(
title: 'Unit Test 4 (äöüß) - update!',
state_id: Ticket::State.lookup(name: 'open').id,
priority_id: Ticket::Priority.lookup(name: '1 low').id,
@@ -398,7 +398,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2), false)
# pending reminder, just let new owner to unseed
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'pending reminder'),
updated_by_id: @agent_user2.id,
@@ -409,7 +409,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
# pending reminder, just let new owner to unseed
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: 1,
state: Ticket::State.lookup(name: 'pending reminder'),
updated_by_id: @agent_user2.id,
@@ -420,7 +420,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), false)
# pending reminder, self done, all to unseed
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'pending reminder'),
updated_by_id: @agent_user1.id,
@@ -431,7 +431,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
# pending close, all to unseen
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'pending close'),
updated_by_id: @agent_user2.id,
@@ -442,7 +442,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
# to open, all to seen
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'open'),
updated_by_id: @agent_user2.id,
@@ -453,7 +453,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), false)
# to closed, all only others to seen
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'closed'),
updated_by_id: @agent_user2.id,
@@ -464,7 +464,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
# to closed by owner self, all to seen
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'closed'),
updated_by_id: @agent_user1.id,
@@ -475,7 +475,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
# to closed by owner self, all to seen
- ticket1.update_attributes(
+ ticket1.update!(
owner_id: @agent_user1.id,
state: Ticket::State.lookup(name: 'merged'),
updated_by_id: @agent_user2.id,
diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb
index bcf9405c9..b3a029774 100644
--- a/test/unit/session_basic_test.rb
+++ b/test/unit/session_basic_test.rb
@@ -243,7 +243,7 @@ class SessionBasicTest < ActiveSupport::TestCase
result1 = as_client1.push
assert(!result1, 'check as agent1 - recall 2')
- agent1.update_attribute(:email, 'activity-stream-agent11@example.com')
+ agent1.update!(email: 'activity-stream-agent11@example.com')
ticket = Ticket.create!(
title: '12323',
group_id: 1,
diff --git a/test/unit/ticket_sla_test.rb b/test/unit/ticket_sla_test.rb
index 2b6e0d814..3f0c45454 100644
--- a/test/unit/ticket_sla_test.rb
+++ b/test/unit/ticket_sla_test.rb
@@ -168,7 +168,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 2')
# set first response in time
- ticket.update_attributes(
+ ticket.update!(
first_response_at: '2013-03-21 10:00:00 UTC',
)
@@ -187,7 +187,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 3')
# set first reponse over time
- ticket.update_attributes(
+ ticket.update!(
first_response_at: '2013-03-21 14:00:00 UTC',
)
@@ -206,7 +206,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 4')
# set update time in time
- ticket.update_attributes(
+ ticket.update!(
last_contact_agent_at: '2013-03-21 11:00:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 5')
@@ -225,7 +225,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 5')
# set update time over time
- ticket.update_attributes(
+ ticket.update!(
last_contact_agent_at: '2013-03-21 12:00:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
@@ -244,7 +244,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
# set update time over time
- ticket.update_attributes(
+ ticket.update!(
last_contact_customer_at: '2013-03-21 12:05:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
@@ -263,7 +263,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
# set update time over time
- ticket.update_attributes(
+ ticket.update!(
last_contact_agent_at: '2013-03-21 12:10:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
@@ -282,7 +282,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
# set close time in time
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-03-21 11:30:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_at verify 7')
@@ -301,7 +301,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal(ticket.close_diff_in_min, 60, 'ticket.close_diff_in_min verify 7')
# set close time over time
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-03-21 13:00:00 UTC',
)
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_at verify 8')
@@ -320,7 +320,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal(ticket.close_diff_in_min, -30, 'ticket.close_diff_in_min verify 8')
# set close time over time
- ticket.update_attributes(
+ ticket.update!(
state: Ticket::State.lookup(name: 'closed')
)
assert_nil(ticket.escalation_at, 'ticket.escalation_at verify 9')
@@ -1097,12 +1097,12 @@ class TicketSlaTest < ActiveSupport::TestCase
)
# set update time
- ticket.update_attributes(
+ ticket.update!(
last_contact_agent_at: '2013-06-04 10:15:00 UTC',
)
# set first response time
- ticket.update_attributes(
+ ticket.update!(
first_response_at: '2013-06-04 10:45:00 UTC',
)
@@ -1121,7 +1121,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_at: '2013-06-04 12:00:00 UTC'
)
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-06-04 12:00:00 UTC',
)
@@ -1218,7 +1218,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_at: '2013-06-04 12:00:00 UTC',
updated_at: '2013-06-04 12:00:00 UTC',
)
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-06-04 12:00:00 UTC',
)
ticket.escalation_calculation(true)
@@ -1346,7 +1346,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_at: '2013-06-04 12:00:00 UTC',
updated_at: '2013-06-04 12:00:00 UTC',
)
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-06-04 12:00:00 UTC',
)
@@ -1489,7 +1489,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_at: '2013-06-04 12:00:00 UTC',
updated_at: '2013-06-04 12:00:00 UTC',
)
- ticket.update_attributes(
+ ticket.update!(
close_at: '2013-06-04 12:00:00 UTC',
)
@@ -2074,7 +2074,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_nil(ticket.close_escalation_at, 'ticket.close_escalation_at verify 1')
# set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 3:00-18:00
- calendar.update_attributes(
+ calendar.update!(
business_hours: {
mon: {
active: true,
diff --git a/test/unit/ticket_trigger_test.rb b/test/unit/ticket_trigger_test.rb
index 724650e60..2310efbd8 100644
--- a/test/unit/ticket_trigger_test.rb
+++ b/test/unit/ticket_trigger_test.rb
@@ -1497,7 +1497,7 @@ class TicketTriggerTest < ActiveSupport::TestCase
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
assert_equal([], ticket1.tag_list)
- ticket1.update_attribute(:customer, User.lookup(email: 'nicole.braun@zammad.org') )
+ ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') )
UserInfo.current_user_id = agent.id
Ticket::Article.create(
@@ -1608,7 +1608,7 @@ class TicketTriggerTest < ActiveSupport::TestCase
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
assert_equal([], ticket1.tag_list)
- ticket1.update_attribute(:customer, customer )
+ ticket1.update!(customer: customer )
UserInfo.current_user_id = agent.id
Ticket::Article.create(
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 89447737c..1dcdae943 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -271,7 +271,7 @@ class UserTest < ActiveSupport::TestCase
assert_equal(test[:create_verify][:image_md5], file_md5, "create avatar md5 check in (#{test[:name]})")
end
if test[:update]
- user.update_attributes( test[:update] )
+ user.update!( test[:update] )
test[:update_verify].each { |key, value|
next if key == :image_md5
@@ -848,18 +848,18 @@ class UserTest < ActiveSupport::TestCase
admin_count_inital = User.with_permissions('admin').count
assert_equal(3, admin_count_inital)
- admin1.update_attribute(:roles, Role.where(name: %w(Agent)))
+ admin1.update!(roles: Role.where(name: %w(Agent)))
admin_count_inital = User.with_permissions('admin').count
assert_equal(2, admin_count_inital)
- admin2.update_attribute(:roles, Role.where(name: %w(Agent)))
+ admin2.update!(roles: Role.where(name: %w(Agent)))
admin_count_inital = User.with_permissions('admin').count
assert_equal(1, admin_count_inital)
assert_raises(Exceptions::UnprocessableEntity) {
- admin3.update_attribute(:roles, Role.where(name: %w(Agent)))
+ admin3.update!(roles: Role.where(name: %w(Agent)))
}
admin_count_inital = User.with_permissions('admin').count