Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
578684ec89
79 changed files with 162 additions and 666 deletions
|
@ -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'] }
|
|
||||||
|
|
|
@ -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 },
|
|
||||||
]
|
|
|
@ -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
|
|
|
@ -1,3 +0,0 @@
|
||||||
class App.NetworkCategoryType extends App.Model
|
|
||||||
@configure 'NetworkCategoryType', 'name', 'note', 'active', 'updated_at'
|
|
||||||
@extend Spine.Model.Ajax
|
|
|
@ -1,3 +0,0 @@
|
||||||
class App.NetworkPrivacy extends App.Model
|
|
||||||
@configure 'NetworkPrivacy', 'name', 'key', 'updated_at'
|
|
||||||
@extend Spine.Model.Ajax
|
|
|
@ -1,84 +0,0 @@
|
||||||
<div class="page-header">
|
|
||||||
<div class="page-header-title">
|
|
||||||
<h1>Networking <small></small></h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="">
|
|
||||||
|
|
||||||
<% for network in @networks: %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="span9">
|
|
||||||
<h2><%= network.name %> <small><%= network.note %></small></h2> <span data-id="<%= network.id %>"><a data-type="network-edit" href="#">edit</a> | <a data-type="network-destroy" href="#">delete</a> | <a data-type="network-category-new" href="#">new category</a></span>
|
|
||||||
<div class="row">
|
|
||||||
<div class="span4">
|
|
||||||
<h4>Announcements</h4>
|
|
||||||
<span data-id="<%= network.id %>"><a data-type="network-category-edit" href="#">edit</a> | <a data-type="network-category-destroy" href="#">delete</a></span>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="span4">
|
|
||||||
<h4>Questions</h4>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="span4">
|
|
||||||
<h4>Ideas</h4>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="span4">
|
|
||||||
<h4>Bugs</h4>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
<li><a href="#">New XXX</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="span3">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="span3">
|
|
||||||
<h2>Actions</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a data-type="network-new" href="">New Network</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="span3">
|
|
||||||
<h2>Activity Stream</h2>
|
|
||||||
<ul>
|
|
||||||
<li>New XXX</li>
|
|
||||||
<li>New XXX</li>
|
|
||||||
<li>New XXX</li>
|
|
||||||
<li>New XXX</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -41,7 +41,7 @@ module ApplicationController::RendersModels
|
||||||
generic_object.with_lock do
|
generic_object.with_lock do
|
||||||
|
|
||||||
# set attributes
|
# set attributes
|
||||||
generic_object.update_attributes!(clean_params)
|
generic_object.update!(clean_params)
|
||||||
|
|
||||||
# set relations
|
# set relations
|
||||||
generic_object.associations_from_param(params)
|
generic_object.associations_from_param(params)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ApplicationsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
application = Doorkeeper::Application.find(params[:id])
|
application = Doorkeeper::Application.find(params[:id])
|
||||||
application.update_attributes!(clean_params)
|
application.update!(clean_params)
|
||||||
render json: application, status: :ok
|
render json: application, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class ChannelsEmailController < ApplicationController
|
||||||
# update account
|
# update account
|
||||||
if channel_id
|
if channel_id
|
||||||
channel = Channel.find(channel_id)
|
channel = Channel.find(channel_id)
|
||||||
channel.update_attributes(
|
channel.update!(
|
||||||
options: {
|
options: {
|
||||||
inbound: params[:inbound].to_h,
|
inbound: params[:inbound].to_h,
|
||||||
outbound: params[:outbound].to_h,
|
outbound: params[:outbound].to_h,
|
||||||
|
@ -163,7 +163,7 @@ class ChannelsEmailController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if address
|
if address
|
||||||
address.update_attributes(
|
address.update!(
|
||||||
realname: params[:meta][:realname],
|
realname: params[:meta][:realname],
|
||||||
email: email,
|
email: email,
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Integration::ExchangeController < ApplicationController
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
endpoint: client.autodiscover.ews_url,
|
endpoint: client.try(:autodiscover).try(:ews_url),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -111,7 +111,7 @@ class TicketArticlesController < ApplicationController
|
||||||
clean_params = Ticket::Article.association_name_to_id_convert(params)
|
clean_params = Ticket::Article.association_name_to_id_convert(params)
|
||||||
clean_params = Ticket::Article.param_cleanup(clean_params, true)
|
clean_params = Ticket::Article.param_cleanup(clean_params, true)
|
||||||
|
|
||||||
article.update_attributes!(clean_params)
|
article.update!(clean_params)
|
||||||
|
|
||||||
if params[:expand]
|
if params[:expand]
|
||||||
result = article.attributes_with_association_names
|
result = article.attributes_with_association_names
|
||||||
|
|
|
@ -192,7 +192,7 @@ class TicketsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
ticket.with_lock do
|
ticket.with_lock do
|
||||||
ticket.update_attributes!(clean_params)
|
ticket.update!(clean_params)
|
||||||
if params[:article]
|
if params[:article]
|
||||||
article_create(ticket, params[:article])
|
article_create(ticket, params[:article])
|
||||||
end
|
end
|
||||||
|
|
|
@ -253,7 +253,7 @@ class UsersController < ApplicationController
|
||||||
user.with_lock do
|
user.with_lock do
|
||||||
clean_params = User.association_name_to_id_convert(params)
|
clean_params = User.association_name_to_id_convert(params)
|
||||||
clean_params = User.param_cleanup(clean_params, true)
|
clean_params = User.param_cleanup(clean_params, true)
|
||||||
user.update_attributes(clean_params)
|
user.update!(clean_params)
|
||||||
|
|
||||||
# only allow Admin's
|
# only allow Admin's
|
||||||
if current_user.permissions?('admin.user') && (params[:role_ids] || params[:roles])
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
user.update_attributes(password: params[:password_new])
|
user.update!(password: params[:password_new])
|
||||||
|
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'password_change',
|
template: 'password_change',
|
||||||
|
@ -980,7 +980,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
|
|
||||||
# update user link
|
# update user link
|
||||||
user = User.find(current_user.id)
|
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
|
render json: { avatar: avatar }, status: :ok
|
||||||
end
|
end
|
||||||
|
@ -996,7 +996,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
|
|
||||||
# update user link
|
# update user link
|
||||||
user = User.find(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
|
render json: {}, status: :ok
|
||||||
end
|
end
|
||||||
|
@ -1013,7 +1013,7 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
# update user link
|
# update user link
|
||||||
avatar = Avatar.get_default('User', current_user.id)
|
avatar = Avatar.get_default('User', current_user.id)
|
||||||
user = User.find(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
|
render json: {}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -119,7 +119,7 @@ returns
|
||||||
if data[:id]
|
if data[:id]
|
||||||
record = find_by(id: data[:id])
|
record = find_by(id: data[:id])
|
||||||
if record
|
if record
|
||||||
record.update_attributes(data)
|
record.update!(data)
|
||||||
return record
|
return record
|
||||||
end
|
end
|
||||||
record = new(data)
|
record = new(data)
|
||||||
|
@ -135,7 +135,7 @@ returns
|
||||||
end
|
end
|
||||||
records.each { |loop_record|
|
records.each { |loop_record|
|
||||||
if loop_record.name == data[:name]
|
if loop_record.name == data[:name]
|
||||||
loop_record.update_attributes(data)
|
loop_record.update!(data)
|
||||||
return loop_record
|
return loop_record
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ returns
|
||||||
end
|
end
|
||||||
records.each { |loop_record|
|
records.each { |loop_record|
|
||||||
if loop_record.login.casecmp(data[:login]).zero?
|
if loop_record.login.casecmp(data[:login]).zero?
|
||||||
loop_record.update_attributes(data)
|
loop_record.update!(data)
|
||||||
return loop_record
|
return loop_record
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ returns
|
||||||
end
|
end
|
||||||
records.each { |loop_record|
|
records.each { |loop_record|
|
||||||
if loop_record.email.casecmp(data[:email]).zero?
|
if loop_record.email.casecmp(data[:email]).zero?
|
||||||
loop_record.update_attributes(data)
|
loop_record.update!(data)
|
||||||
return loop_record
|
return loop_record
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ returns
|
||||||
end
|
end
|
||||||
records.each { |loop_record|
|
records.each { |loop_record|
|
||||||
if loop_record.locale.casecmp(data[:locale]).zero?
|
if loop_record.locale.casecmp(data[:locale]).zero?
|
||||||
loop_record.update_attributes(data)
|
loop_record.update!(data)
|
||||||
return loop_record
|
return loop_record
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ class Authorization < ApplicationModel
|
||||||
if auth
|
if auth
|
||||||
|
|
||||||
# update auth tokens
|
# update auth tokens
|
||||||
auth.update_attributes(
|
auth.update!(
|
||||||
token: hash['credentials']['token'],
|
token: hash['credentials']['token'],
|
||||||
secret: hash['credentials']['secret']
|
secret: hash['credentials']['secret']
|
||||||
)
|
)
|
||||||
|
|
||||||
# update username of auth entry if empty
|
# update username of auth entry if empty
|
||||||
if !auth.username && hash['info']['nickname']
|
if !auth.username && hash['info']['nickname']
|
||||||
auth.update_attributes(
|
auth.update!(
|
||||||
username: hash['info']['nickname'],
|
username: hash['info']['nickname'],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -211,7 +211,7 @@ add avatar by url
|
||||||
|
|
||||||
# update existing
|
# update existing
|
||||||
if avatar_already_exists
|
if avatar_already_exists
|
||||||
avatar_already_exists.update_attributes(record)
|
avatar_already_exists.update!(record)
|
||||||
avatar = avatar_already_exists
|
avatar = avatar_already_exists
|
||||||
|
|
||||||
# add new one and set it as default
|
# add new one and set it as default
|
||||||
|
|
|
@ -47,7 +47,7 @@ returns calendar object
|
||||||
# find if auto generated calendar exists
|
# find if auto generated calendar exists
|
||||||
calendar = Calendar.find_by(default: true, updated_by_id: 1, created_by_id: 1)
|
calendar = Calendar.find_by(default: true, updated_by_id: 1, created_by_id: 1)
|
||||||
if calendar
|
if calendar
|
||||||
calendar.update_attributes(calendar_details)
|
calendar.update!(calendar_details)
|
||||||
return calendar
|
return calendar
|
||||||
end
|
end
|
||||||
create(calendar_details)
|
create(calendar_details)
|
||||||
|
|
|
@ -141,7 +141,7 @@ module Channel::Filter::IdentifySender
|
||||||
if user.firstname.blank? && user.lastname.blank?
|
if user.firstname.blank? && user.lastname.blank?
|
||||||
if data[:firstname].present?
|
if data[:firstname].present?
|
||||||
data[:firstname] = cleanup_name(data[:firstname])
|
data[:firstname] = cleanup_name(data[:firstname])
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
firstname: data[:firstname]
|
firstname: data[:firstname]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -166,7 +166,7 @@ module Channel::Filter::IdentifySender
|
||||||
data[:created_by_id] = 1
|
data[:created_by_id] = 1
|
||||||
|
|
||||||
user = User.create(data)
|
user = User.create(data)
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
updated_by_id: user.id,
|
updated_by_id: user.id,
|
||||||
created_by_id: user.id,
|
created_by_id: user.id,
|
||||||
)
|
)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Chat::Agent < ApplicationModel
|
||||||
updated_by_id: params[:updated_by_id]
|
updated_by_id: params[:updated_by_id]
|
||||||
)
|
)
|
||||||
if chat_agent
|
if chat_agent
|
||||||
chat_agent.update_attributes(params)
|
chat_agent.update!(params)
|
||||||
else
|
else
|
||||||
Chat::Agent.create(params)
|
Chat::Agent.create(params)
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
# delete group.email_address_id reference if email address get's deleted
|
||||||
def delete_group_reference
|
def delete_group_reference
|
||||||
Group.where(email_address_id: id).each { |group|
|
Group.where(email_address_id: id).each { |group|
|
||||||
group.update_attributes!(email_address_id: nil)
|
group.update!(email_address_id: nil)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ add a new history entry for an object
|
||||||
history_record = History.find_by(id: data[:id])
|
history_record = History.find_by(id: data[:id])
|
||||||
end
|
end
|
||||||
if history_record
|
if history_record
|
||||||
history_record.update_attributes(record)
|
history_record.update!(record)
|
||||||
else
|
else
|
||||||
record_new = History.create(record)
|
record_new = History.create(record)
|
||||||
if record[:id]
|
if record[:id]
|
||||||
|
|
|
@ -117,9 +117,9 @@ all:
|
||||||
data.each { |locale|
|
data.each { |locale|
|
||||||
exists = Locale.find_by(locale: locale['locale'])
|
exists = Locale.find_by(locale: locale['locale'])
|
||||||
if exists
|
if exists
|
||||||
exists.update(locale.symbolize_keys!)
|
exists.update!(locale.symbolize_keys!)
|
||||||
else
|
else
|
||||||
Locale.create(locale.symbolize_keys!)
|
Locale.create!(locale.symbolize_keys!)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
|
@ -169,7 +169,7 @@ class Scheduler < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
def self._start_job(job, try_count = 0, try_run_time = Time.zone.now)
|
def self._start_job(job, try_count = 0, try_run_time = Time.zone.now)
|
||||||
job.update(
|
job.update!(
|
||||||
last_run: Time.zone.now,
|
last_run: Time.zone.now,
|
||||||
pid: Thread.current.object_id,
|
pid: Thread.current.object_id,
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
|
@ -205,7 +205,7 @@ class Scheduler < ApplicationModel
|
||||||
error = "Failed to run #{job.method} after #{try_count} tries #{e.inspect}"
|
error = "Failed to run #{job.method} after #{try_count} tries #{e.inspect}"
|
||||||
logger.error error
|
logger.error error
|
||||||
|
|
||||||
job.update(
|
job.update!(
|
||||||
error_message: error,
|
error_message: error,
|
||||||
status: 'error',
|
status: 'error',
|
||||||
active: false,
|
active: false,
|
||||||
|
@ -285,7 +285,7 @@ class Scheduler < ApplicationModel
|
||||||
# return [true]
|
# return [true]
|
||||||
def self.restart_failed_jobs
|
def self.restart_failed_jobs
|
||||||
failed_jobs.each do |job|
|
failed_jobs.each do |job|
|
||||||
job.update(active: true)
|
job.update!(active: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -38,7 +38,7 @@ load text modules from online
|
||||||
exists = TextModule.find_by(foreign_id: text_module['foreign_id'])
|
exists = TextModule.find_by(foreign_id: text_module['foreign_id'])
|
||||||
if exists
|
if exists
|
||||||
next if !overwrite_existing_item
|
next if !overwrite_existing_item
|
||||||
exists.update(text_module.symbolize_keys!)
|
exists.update!(text_module.symbolize_keys!)
|
||||||
else
|
else
|
||||||
text_module[:updated_by_id] = 1
|
text_module[:updated_by_id] = 1
|
||||||
text_module[:created_by_id] = 1
|
text_module[:created_by_id] = 1
|
||||||
|
|
|
@ -371,7 +371,7 @@ Get source file at https://i18n.zammad.com/api/v1/translations_empty_translation
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
if update_needed
|
if update_needed
|
||||||
translation.update_attributes(translation_raw.symbolize_keys!)
|
translation.update!(translation_raw.symbolize_keys!)
|
||||||
translation.save
|
translation.save
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -610,7 +610,7 @@ returns
|
||||||
return if !user
|
return if !user
|
||||||
|
|
||||||
# reset password
|
# reset password
|
||||||
user.update_attributes(password: password)
|
user.update!(password: password)
|
||||||
|
|
||||||
# delete token
|
# delete token
|
||||||
Token.find_by(action: 'PasswordReset', name: token).destroy
|
Token.find_by(action: 'PasswordReset', name: token).destroy
|
||||||
|
@ -689,7 +689,7 @@ returns
|
||||||
return if user && local_user.id != user.id
|
return if user && local_user.id != user.id
|
||||||
|
|
||||||
# set verified
|
# set verified
|
||||||
local_user.update_attributes(verified: true)
|
local_user.update!(verified: true)
|
||||||
|
|
||||||
# delete token
|
# delete token
|
||||||
Token.find_by(action: 'Signup', name: token).destroy
|
Token.find_by(action: 'Signup', name: token).destroy
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
18
db/migrate/20170912123300_remove_network.rb
Normal file
18
db/migrate/20170912123300_remove_network.rb
Normal file
|
@ -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
|
|
@ -13,7 +13,7 @@ Cache.clear
|
||||||
# this is the __ordered__ list of seed files
|
# this is the __ordered__ list of seed files
|
||||||
# extend only if needed - try to add your changes
|
# extend only if needed - try to add your changes
|
||||||
# to the matching one of the existing files
|
# 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
|
# loop and require all seedfiles
|
||||||
# files will get executed automatically
|
# files will get executed automatically
|
||||||
|
|
|
@ -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....',
|
|
||||||
)
|
|
|
@ -147,7 +147,7 @@ result
|
||||||
next if !new_value || new_value.empty?
|
next if !new_value || new_value.empty?
|
||||||
user_data[target] = new_value
|
user_data[target] = new_value
|
||||||
}
|
}
|
||||||
user.update_attributes(user_data)
|
user.update!(user_data)
|
||||||
else
|
else
|
||||||
user_data[:login] = item_user['id']
|
user_data[:login] = item_user['id']
|
||||||
if item_user['first_name'] && item_user['last_name']
|
if item_user['first_name'] && item_user['last_name']
|
||||||
|
|
|
@ -135,9 +135,9 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
def inform(message)
|
def inform(message)
|
||||||
@import_job.update_attribute(:result, {
|
@import_job.update!(result: {
|
||||||
info: message
|
info: message
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ module Import
|
||||||
# the active state this way to send notifications
|
# the active state this way to send notifications
|
||||||
# to the client
|
# to the client
|
||||||
::User.where(id: slice).each do |user|
|
::User.where(id: slice).each do |user|
|
||||||
user.update_attribute(:active, false)
|
user.update!(active: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ module Import
|
||||||
@local_article = ::Ticket::Article.find_by(id: article[:id])
|
@local_article = ::Ticket::Article.find_by(id: article[:id])
|
||||||
return false if !@local_article
|
return false if !@local_article
|
||||||
log "update Ticket::Article.find_by(id: #{article[:id]})"
|
log "update Ticket::Article.find_by(id: #{article[:id]})"
|
||||||
@local_article.update_attributes(article)
|
@local_article.update!(article)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ module Import
|
||||||
@local_customer = Organization.find_by(name: customer[:name])
|
@local_customer = Organization.find_by(name: customer[:name])
|
||||||
return false if !@local_customer
|
return false if !@local_customer
|
||||||
log "update Organization.find_by(name: #{customer[:name]})"
|
log "update Organization.find_by(name: #{customer[:name]})"
|
||||||
@local_customer.update_attributes(customer)
|
@local_customer.update!(customer)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
log "update User.find_by(login: #{customer[:login]})"
|
log "update User.find_by(login: #{customer[:login]})"
|
||||||
@local_customer.update_attributes(customer)
|
@local_customer.update!(customer)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Import
|
||||||
@local_priority = ::Ticket::Priority.find_by(id: priority[:id])
|
@local_priority = ::Ticket::Priority.find_by(id: priority[:id])
|
||||||
return false if !@local_priority
|
return false if !@local_priority
|
||||||
log "update Ticket::Priority.find_by(id: #{priority[:id]})"
|
log "update Ticket::Priority.find_by(id: #{priority[:id]})"
|
||||||
@local_priority.update_attributes(priority)
|
@local_priority.update!(priority)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ module Import
|
||||||
@local_queue = Group.find_by(id: queue[:id])
|
@local_queue = Group.find_by(id: queue[:id])
|
||||||
return false if !@local_queue
|
return false if !@local_queue
|
||||||
log "update Group.find_by(id: #{queue[:id]})"
|
log "update Group.find_by(id: #{queue[:id]})"
|
||||||
@local_queue.update_attributes(queue)
|
@local_queue.update!(queue)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Import
|
||||||
@local_state = ::Ticket::State.find_by(id: state[:id])
|
@local_state = ::Ticket::State.find_by(id: state[:id])
|
||||||
return false if !@local_state
|
return false if !@local_state
|
||||||
log "update Ticket::State.find_by(id: #{state[:id]})"
|
log "update Ticket::State.find_by(id: #{state[:id]})"
|
||||||
@local_state.update_attributes(state)
|
@local_state.update!(state)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ module Import
|
||||||
@local_ticket = ::Ticket.find_by(id: ticket[:id])
|
@local_ticket = ::Ticket.find_by(id: ticket[:id])
|
||||||
return false if !@local_ticket
|
return false if !@local_ticket
|
||||||
log "update Ticket.find_by(id: #{ticket[:id]})"
|
log "update Ticket.find_by(id: #{ticket[:id]})"
|
||||||
@local_ticket.update_attributes(ticket)
|
@local_ticket.update!(ticket)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
log "update User.find_by(id: #{user[:id]})"
|
log "update User.find_by(id: #{user[:id]})"
|
||||||
@local_user.update_attributes(user)
|
@local_user.update!(user)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Import
|
||||||
def updated?(ticket)
|
def updated?(ticket)
|
||||||
@local_ticket = ::Ticket.find_by(id: ticket[:id])
|
@local_ticket = ::Ticket.find_by(id: ticket[:id])
|
||||||
return false if !@local_ticket
|
return false if !@local_ticket
|
||||||
@local_ticket.update_attributes(ticket)
|
@local_ticket.update!(ticket)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ module Import
|
||||||
def updated?(article)
|
def updated?(article)
|
||||||
@local_article = ::Ticket::Article.find_by(message_id: article[:message_id])
|
@local_article = ::Ticket::Article.find_by(message_id: article[:message_id])
|
||||||
return false if !@local_article
|
return false if !@local_article
|
||||||
@local_article.update_attributes(article)
|
@local_article.update!(article)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ returns
|
||||||
}
|
}
|
||||||
if auth
|
if auth
|
||||||
user = User.find(auth.user_id)
|
user = User.find(auth.user_id)
|
||||||
user.update_attributes(user_data)
|
user.update!(user_data)
|
||||||
else
|
else
|
||||||
if message_user[:username]
|
if message_user[:username]
|
||||||
user_data[:note] = "Telegram @#{message_user[:username]}"
|
user_data[:note] = "Telegram @#{message_user[:username]}"
|
||||||
|
@ -261,7 +261,7 @@ returns
|
||||||
provider: 'telegram'
|
provider: 'telegram'
|
||||||
}
|
}
|
||||||
if auth
|
if auth
|
||||||
auth.update_attributes(auth_data)
|
auth.update!(auth_data)
|
||||||
else
|
else
|
||||||
Authorization.create(auth_data)
|
Authorization.create(auth_data)
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,7 @@ class TweetBase
|
||||||
next if !new_value || new_value.empty?
|
next if !new_value || new_value.empty?
|
||||||
user_data[target] = new_value
|
user_data[target] = new_value
|
||||||
}
|
}
|
||||||
user.update_attributes(user_data)
|
user.update!(user_data)
|
||||||
else
|
else
|
||||||
user_data[:login] = tweet_user.screen_name
|
user_data[:login] = tweet_user.screen_name
|
||||||
user_data[:firstname] = tweet_user.name
|
user_data[:firstname] = tweet_user.name
|
||||||
|
@ -91,7 +91,7 @@ class TweetBase
|
||||||
provider: 'twitter'
|
provider: 'twitter'
|
||||||
}
|
}
|
||||||
if auth
|
if auth
|
||||||
auth.update_attributes(auth_data)
|
auth.update!(auth_data)
|
||||||
else
|
else
|
||||||
Authorization.create!(auth_data)
|
Authorization.create!(auth_data)
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,8 +121,8 @@ RSpec.describe Import::BaseResource do
|
||||||
old_signature = create(:signature)
|
old_signature = create(:signature)
|
||||||
old_users = create_list(:user, 2)
|
old_users = create_list(:user, 2)
|
||||||
|
|
||||||
group.update_attribute(:signature_id, old_signature.id)
|
group.update!(signature_id: old_signature.id)
|
||||||
group.update_attribute(:user_ids, old_users.collect(&:id))
|
group.update!(user_ids: old_users.collect(&:id))
|
||||||
|
|
||||||
# simulate next import run
|
# simulate next import run
|
||||||
travel 20.minutes
|
travel 20.minutes
|
||||||
|
|
|
@ -245,7 +245,7 @@ RSpec.describe Import::Ldap::User do
|
||||||
|
|
||||||
it "doesn't detect false changes" do
|
it "doesn't detect false changes" do
|
||||||
# make sure that the nothing has changed
|
# 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!)
|
expect_any_instance_of(User).not_to receive(:save!)
|
||||||
instance = described_class.new(user_entry, ldap_config, user_roles, signup_role_ids)
|
instance = described_class.new(user_entry, ldap_config, user_roles, signup_role_ids)
|
||||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Article do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe Import::OTRS::Customer do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,9 +15,9 @@ RSpec.describe Import::OTRS::CustomerUser do
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
expect(import_object).to receive(:find_by).and_return(existing_object)
|
||||||
# we delete the :role_ids from the zammad_structure to make sure that
|
# we delete the :role_ids from the zammad_structure to make sure that
|
||||||
# a) role_ids call returns the initial role_ids
|
# 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(: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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Priority do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Queue do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe Import::OTRS::State do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe Import::OTRS::Ticket do
|
||||||
|
|
||||||
def updates_with(zammad_structure)
|
def updates_with(zammad_structure)
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,9 +14,9 @@ RSpec.describe Import::OTRS::User do
|
||||||
expect(import_object).to receive(:find_by).and_return(existing_object)
|
expect(import_object).to receive(:find_by).and_return(existing_object)
|
||||||
# we delete the :role_ids from the zammad_structure to make sure that
|
# we delete the :role_ids from the zammad_structure to make sure that
|
||||||
# a) role_ids call returns the initial role_ids
|
# 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(: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)
|
expect(import_object).not_to receive(:new)
|
||||||
start_import_test
|
start_import_test
|
||||||
end
|
end
|
||||||
|
|
|
@ -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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
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])
|
expect(Import::Zendesk::Ticket::Comment::Sender).to receive(:local_id).with(local_user_id).and_return(update_structure[:sender_id])
|
||||||
|
|
||||||
local_article = double()
|
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)
|
expect(::Ticket::Article).to receive(:find_by).with(message_id: comment.id).and_return(local_article)
|
||||||
|
|
||||||
|
|
|
@ -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(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(::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)
|
created_instance = described_class.new(ticket)
|
||||||
end
|
end
|
||||||
|
|
|
@ -279,7 +279,7 @@ RSpec.describe Ldap do
|
||||||
expect(mocked_ldap).to receive(:search).with(include(expected)).and_yield(yield_entry).and_return(true)
|
expect(mocked_ldap).to receive(:search).with(include(expected)).and_yield(yield_entry).and_return(true)
|
||||||
|
|
||||||
check_entry = nil
|
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)
|
expect(check_entry).to eq(yield_entry)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ RSpec.shared_examples 'HasGroups' do
|
||||||
|
|
||||||
context 'group' do
|
context 'group' do
|
||||||
let(:group_access_instance_inactive) {
|
let(:group_access_instance_inactive) {
|
||||||
group_access_instance.update_attribute(:active, false)
|
group_access_instance.update!(active: false)
|
||||||
group_access_instance
|
group_access_instance
|
||||||
}
|
}
|
||||||
let(:group_full) { create(:group) }
|
let(:group_full) { create(:group) }
|
||||||
|
|
|
@ -5,7 +5,7 @@ RSpec.shared_examples 'HasRoles' do
|
||||||
context 'role' do
|
context 'role' do
|
||||||
|
|
||||||
let(:group_access_instance_inactive) {
|
let(:group_access_instance_inactive) {
|
||||||
group_access_instance.update_attribute(:active, false)
|
group_access_instance.update!(active: false)
|
||||||
group_access_instance
|
group_access_instance
|
||||||
}
|
}
|
||||||
let(:role) { create(:role) }
|
let(:role) { create(:role) }
|
||||||
|
|
|
@ -221,7 +221,7 @@ RSpec.describe ImportJob do
|
||||||
instance = create(:import_job)
|
instance = create(:import_job)
|
||||||
delayed_job = double()
|
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
|
expect(instance.reschedule?(delayed_job)).to be false
|
||||||
end
|
end
|
||||||
|
|
|
@ -117,7 +117,7 @@ RSpec.describe Scheduler do
|
||||||
|
|
||||||
# lock job (simluates interrupted scheduler task)
|
# lock job (simluates interrupted scheduler task)
|
||||||
locked_job = Delayed::Job.last
|
locked_job = Delayed::Job.last
|
||||||
locked_job.update_attribute(:locked_at, Time.zone.now)
|
locked_job.update!(locked_at: Time.zone.now)
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
simulate_threads_call
|
simulate_threads_call
|
||||||
|
@ -134,7 +134,7 @@ RSpec.describe Scheduler do
|
||||||
|
|
||||||
# lock job (simluates interrupted scheduler task)
|
# lock job (simluates interrupted scheduler task)
|
||||||
locked_job = Delayed::Job.last
|
locked_job = Delayed::Job.last
|
||||||
locked_job.update_attribute(:locked_at, Time.zone.now)
|
locked_job.update!(locked_at: Time.zone.now)
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
simulate_threads_call
|
simulate_threads_call
|
||||||
|
@ -151,7 +151,7 @@ RSpec.describe Scheduler do
|
||||||
|
|
||||||
# lock job (simluates interrupted scheduler task)
|
# lock job (simluates interrupted scheduler task)
|
||||||
locked_job = Delayed::Job.last
|
locked_job = Delayed::Job.last
|
||||||
locked_job.update_attribute(:locked_at, Time.zone.now)
|
locked_job.update!(locked_at: Time.zone.now)
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
simulate_threads_call
|
simulate_threads_call
|
||||||
|
|
|
@ -213,14 +213,14 @@ RSpec.describe Ticket do
|
||||||
pending_time: Time.zone.now + 2.days)
|
pending_time: Time.zone.now + 2.days)
|
||||||
expect(ticket.pending_time).not_to be nil
|
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
|
expect(ticket.pending_time).to be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'lets handle ActiveRecord nil as new value' do
|
it 'lets handle ActiveRecord nil as new value' do
|
||||||
ticket = create(:ticket)
|
ticket = create(:ticket)
|
||||||
expect do
|
expect do
|
||||||
ticket.update_attribute(:state, nil)
|
ticket.update!(state: nil)
|
||||||
end.to raise_error(ActiveRecord::StatementInvalid)
|
end.to raise_error(ActiveRecord::StatementInvalid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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)
|
# update with own values (do not overwrite)
|
||||||
customer2.update_attributes(
|
customer2.update!(
|
||||||
firstname: 'Martini',
|
firstname: 'Martini',
|
||||||
note: 'changed by my self',
|
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)
|
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)
|
# update with own values (do not overwrite)
|
||||||
customer2.update_attributes(
|
customer2.update!(
|
||||||
firstname: '',
|
firstname: '',
|
||||||
note: 'changed by my self',
|
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)
|
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)
|
# update with changed values at clearbit site (do overwrite)
|
||||||
customer2.update_attributes(
|
customer2.update!(
|
||||||
email: 'me2@example.com',
|
email: 'me2@example.com',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
|
||||||
assert_nil(article1_lookup.preferences['delivery_status_message'])
|
assert_nil(article1_lookup.preferences['delivery_status_message'])
|
||||||
|
|
||||||
# send with invalid smtp settings
|
# send with invalid smtp settings
|
||||||
channel.update_attributes(
|
channel.update!(
|
||||||
options: {
|
options: {
|
||||||
inbound: {
|
inbound: {
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
|
@ -125,7 +125,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
|
||||||
assert(article1_lookup.preferences['delivery_status_message'])
|
assert(article1_lookup.preferences['delivery_status_message'])
|
||||||
|
|
||||||
# send with correct smtp settings
|
# send with correct smtp settings
|
||||||
channel.update_attributes(
|
channel.update!(
|
||||||
options: {
|
options: {
|
||||||
inbound: {
|
inbound: {
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
|
@ -162,7 +162,7 @@ class EmailDeliverTest < ActiveSupport::TestCase
|
||||||
Delayed::Job.destroy_all
|
Delayed::Job.destroy_all
|
||||||
|
|
||||||
# send with invalid smtp settings
|
# send with invalid smtp settings
|
||||||
channel.update_attributes(
|
channel.update!(
|
||||||
options: {
|
options: {
|
||||||
inbound: {
|
inbound: {
|
||||||
adapter: 'imap',
|
adapter: 'imap',
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
@ticket1.update_attributes(
|
@ticket1.update!(
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'Users'),
|
||||||
updated_at: '2015-10-28 14:30:00 UTC',
|
updated_at: '2015-10-28 14:30:00 UTC',
|
||||||
)
|
)
|
||||||
|
@ -97,7 +97,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
@ticket2.update_attributes(
|
@ticket2.update!(
|
||||||
group_id: group2.id,
|
group_id: group2.id,
|
||||||
updated_at: '2015-10-28 14:30:00 UTC',
|
updated_at: '2015-10-28 14:30:00 UTC',
|
||||||
)
|
)
|
||||||
|
@ -184,7 +184,7 @@ class ReportTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
@ticket5.update_attributes(
|
@ticket5.update!(
|
||||||
state: Ticket::State.lookup(name: 'open'),
|
state: Ticket::State.lookup(name: 'open'),
|
||||||
updated_at: '2015-10-28 14:30:00 UTC',
|
updated_at: '2015-10-28 14:30:00 UTC',
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
travel 100.seconds
|
travel 100.seconds
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
title: 'Unit Test 1 (äöüß) - update!',
|
title: 'Unit Test 1 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'open').id,
|
state_id: Ticket::State.lookup(name: 'open').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').id,
|
priority_id: Ticket::Priority.lookup(name: '1 low').id,
|
||||||
|
@ -55,7 +55,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
updated_at = ticket.updated_at
|
updated_at = ticket.updated_at
|
||||||
|
|
||||||
travel 1.second
|
travel 1.second
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
title: 'Unit Test 2 (äöüß) - update!',
|
title: 'Unit Test 2 (äöüß) - update!',
|
||||||
priority_id: Ticket::Priority.lookup(name: '2 normal').id,
|
priority_id: Ticket::Priority.lookup(name: '2 normal').id,
|
||||||
)
|
)
|
||||||
|
@ -99,11 +99,11 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
travel 100.seconds
|
travel 100.seconds
|
||||||
assert_equal(organization.class, Organization)
|
assert_equal(organization.class, Organization)
|
||||||
|
|
||||||
organization.update_attributes(name: 'some name (äöüß)')
|
organization.update!(name: 'some name (äöüß)')
|
||||||
updated_at = organization.updated_at
|
updated_at = organization.updated_at
|
||||||
|
|
||||||
travel 10.seconds
|
travel 10.seconds
|
||||||
organization.update_attributes(name: 'some name 2 (äöüß)')
|
organization.update!(name: 'some name 2 (äöüß)')
|
||||||
|
|
||||||
# check activity_stream
|
# check activity_stream
|
||||||
stream = @admin_user.activity_stream(3)
|
stream = @admin_user.activity_stream(3)
|
||||||
|
@ -138,7 +138,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
created_by_id: @current_user.id,
|
created_by_id: @current_user.id,
|
||||||
)
|
)
|
||||||
assert_equal(user.class, User)
|
assert_equal(user.class, User)
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
firstname: 'Bob U',
|
firstname: 'Bob U',
|
||||||
lastname: 'Smith U',
|
lastname: 'Smith U',
|
||||||
)
|
)
|
||||||
|
@ -172,14 +172,14 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
travel 100.seconds
|
travel 100.seconds
|
||||||
assert_equal(user.class, User)
|
assert_equal(user.class, User)
|
||||||
|
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
firstname: 'Bob U',
|
firstname: 'Bob U',
|
||||||
lastname: 'Smith U',
|
lastname: 'Smith U',
|
||||||
)
|
)
|
||||||
updated_at = user.updated_at
|
updated_at = user.updated_at
|
||||||
|
|
||||||
travel 10.seconds
|
travel 10.seconds
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
firstname: 'Bob',
|
firstname: 'Bob',
|
||||||
lastname: 'Smith',
|
lastname: 'Smith',
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,7 +5,7 @@ class AuthTest < ActiveSupport::TestCase
|
||||||
test 'auth' do
|
test 'auth' do
|
||||||
|
|
||||||
user = User.find_by(email: 'nicole.braun@zammad.org')
|
user = User.find_by(email: 'nicole.braun@zammad.org')
|
||||||
user.update_attributes(
|
user.update!(
|
||||||
login: 'nicole.braun',
|
login: 'nicole.braun',
|
||||||
firstname: 'Nicole',
|
firstname: 'Nicole',
|
||||||
lastname: 'Braun',
|
lastname: 'Braun',
|
||||||
|
|
|
@ -36,7 +36,7 @@ Subject: #{ticket.subject_build('some new subject')}
|
||||||
|
|
||||||
Some Text"
|
Some Text"
|
||||||
|
|
||||||
users_group.update_attribute('follow_up_possible', 'new_ticket')
|
users_group.update!('follow_up_possible' => 'new_ticket')
|
||||||
|
|
||||||
travel 1.second
|
travel 1.second
|
||||||
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, follow_up_raw)
|
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', ticket_p.title)
|
||||||
assert_equal('some new subject2', article_p.subject)
|
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
|
travel 1.second
|
||||||
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, follow_up_raw)
|
ticket_p, article_p, user_p = Channel::EmailParser.new.process({}, follow_up_raw)
|
||||||
|
|
|
@ -164,10 +164,10 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# update ticket
|
# update ticket
|
||||||
if test[:ticket_update][:ticket]
|
if test[:ticket_update][:ticket]
|
||||||
ticket.update_attributes(test[:ticket_update][:ticket])
|
ticket.update!(test[:ticket_update][:ticket])
|
||||||
end
|
end
|
||||||
if test[:ticket_update][:article]
|
if test[:ticket_update][:article]
|
||||||
article.update_attributes(test[:ticket_update][:article])
|
article.update!(test[:ticket_update][:article])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
# update user
|
# update user
|
||||||
if test[:user_update][:user]
|
if test[:user_update][:user]
|
||||||
test[:user_update][:user][:active] = false
|
test[:user_update][:user][:active] = false
|
||||||
user.update_attributes(test[:user_update][:user])
|
user.update!(test[:user_update][:user])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# update organization
|
# update organization
|
||||||
if test[:organization_update][:organization]
|
if test[:organization_update][:organization]
|
||||||
organization.update_attributes(test[:organization_update][:organization])
|
organization.update!(test[:organization_update][:organization])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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, false))
|
||||||
assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket1.id, 'create', @agent_user1, true))
|
assert(OnlineNotification.exists?(@agent_user2, 'Ticket', ticket1.id, 'create', @agent_user1, true))
|
||||||
|
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
title: 'Unit Test 1 (äöüß) - update!',
|
title: 'Unit Test 1 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'open').id,
|
state_id: Ticket::State.lookup(name: 'open').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').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, false))
|
||||||
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket2.id, 'create', @customer_user, true))
|
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket2.id, 'create', @customer_user, true))
|
||||||
|
|
||||||
ticket2.update_attributes(
|
ticket2.update!(
|
||||||
title: 'Unit Test 1 (äöüß) - update!',
|
title: 'Unit Test 1 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'open').id,
|
state_id: Ticket::State.lookup(name: 'open').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').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, false))
|
||||||
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'create', @agent_user1, true))
|
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket3.id, 'create', @agent_user1, true))
|
||||||
|
|
||||||
ticket3.update_attributes(
|
ticket3.update!(
|
||||||
title: 'Unit Test 2 (äöüß) - update!',
|
title: 'Unit Test 2 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'closed').id,
|
state_id: Ticket::State.lookup(name: 'closed').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').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, false))
|
||||||
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket4.id, 'create', @customer_user, true))
|
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket4.id, 'create', @customer_user, true))
|
||||||
|
|
||||||
ticket4.update_attributes(
|
ticket4.update!(
|
||||||
title: 'Unit Test 3 (äöüß) - update!',
|
title: 'Unit Test 3 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'open').id,
|
state_id: Ticket::State.lookup(name: 'open').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').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, false))
|
||||||
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket5.id, 'create', @agent_user1, true))
|
assert(!OnlineNotification.exists?(@agent_user2, 'Ticket', ticket5.id, 'create', @agent_user1, true))
|
||||||
|
|
||||||
ticket5.update_attributes(
|
ticket5.update!(
|
||||||
title: 'Unit Test 4 (äöüß) - update!',
|
title: 'Unit Test 4 (äöüß) - update!',
|
||||||
state_id: Ticket::State.lookup(name: 'open').id,
|
state_id: Ticket::State.lookup(name: 'open').id,
|
||||||
priority_id: Ticket::Priority.lookup(name: '1 low').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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2), false)
|
||||||
|
|
||||||
# pending reminder, just let new owner to unseed
|
# pending reminder, just let new owner to unseed
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'pending reminder'),
|
state: Ticket::State.lookup(name: 'pending reminder'),
|
||||||
updated_by_id: @agent_user2.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
|
||||||
|
|
||||||
# pending reminder, just let new owner to unseed
|
# pending reminder, just let new owner to unseed
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: 1,
|
owner_id: 1,
|
||||||
state: Ticket::State.lookup(name: 'pending reminder'),
|
state: Ticket::State.lookup(name: 'pending reminder'),
|
||||||
updated_by_id: @agent_user2.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), false)
|
||||||
|
|
||||||
# pending reminder, self done, all to unseed
|
# pending reminder, self done, all to unseed
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'pending reminder'),
|
state: Ticket::State.lookup(name: 'pending reminder'),
|
||||||
updated_by_id: @agent_user1.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
|
||||||
|
|
||||||
# pending close, all to unseen
|
# pending close, all to unseen
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'pending close'),
|
state: Ticket::State.lookup(name: 'pending close'),
|
||||||
updated_by_id: @agent_user2.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
|
||||||
|
|
||||||
# to open, all to seen
|
# to open, all to seen
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'open'),
|
state: Ticket::State.lookup(name: 'open'),
|
||||||
updated_by_id: @agent_user2.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), false)
|
||||||
|
|
||||||
# to closed, all only others to seen
|
# to closed, all only others to seen
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'closed'),
|
state: Ticket::State.lookup(name: 'closed'),
|
||||||
updated_by_id: @agent_user2.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
|
||||||
|
|
||||||
# to closed by owner self, all to seen
|
# to closed by owner self, all to seen
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'closed'),
|
state: Ticket::State.lookup(name: 'closed'),
|
||||||
updated_by_id: @agent_user1.id,
|
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)
|
assert_equal(ticket1.online_notification_seen_state(@agent_user2.id), true)
|
||||||
|
|
||||||
# to closed by owner self, all to seen
|
# to closed by owner self, all to seen
|
||||||
ticket1.update_attributes(
|
ticket1.update!(
|
||||||
owner_id: @agent_user1.id,
|
owner_id: @agent_user1.id,
|
||||||
state: Ticket::State.lookup(name: 'merged'),
|
state: Ticket::State.lookup(name: 'merged'),
|
||||||
updated_by_id: @agent_user2.id,
|
updated_by_id: @agent_user2.id,
|
||||||
|
|
|
@ -243,7 +243,7 @@ class SessionBasicTest < ActiveSupport::TestCase
|
||||||
result1 = as_client1.push
|
result1 = as_client1.push
|
||||||
assert(!result1, 'check as agent1 - recall 2')
|
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!(
|
ticket = Ticket.create!(
|
||||||
title: '12323',
|
title: '12323',
|
||||||
group_id: 1,
|
group_id: 1,
|
||||||
|
|
|
@ -168,7 +168,7 @@ class TicketSlaTest < ActiveSupport::TestCase
|
||||||
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 2')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 2')
|
||||||
|
|
||||||
# set first response in time
|
# set first response in time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
first_response_at: '2013-03-21 10:00:00 UTC',
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 3')
|
||||||
|
|
||||||
# set first reponse over time
|
# set first reponse over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
first_response_at: '2013-03-21 14:00:00 UTC',
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 4')
|
||||||
|
|
||||||
# set update time in time
|
# set update time in time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
last_contact_agent_at: '2013-03-21 11:00:00 UTC',
|
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')
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 5')
|
||||||
|
|
||||||
# set update time over time
|
# set update time over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
last_contact_agent_at: '2013-03-21 12:00:00 UTC',
|
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')
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
|
||||||
|
|
||||||
# set update time over time
|
# set update time over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
last_contact_customer_at: '2013-03-21 12:05:00 UTC',
|
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')
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
|
||||||
|
|
||||||
# set update time over time
|
# set update time over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
last_contact_agent_at: '2013-03-21 12:10:00 UTC',
|
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')
|
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')
|
assert_nil(ticket.close_diff_in_min, 'ticket.close_diff_in_min verify 6')
|
||||||
|
|
||||||
# set close time in time
|
# set close time in time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
close_at: '2013-03-21 11:30:00 UTC',
|
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')
|
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')
|
assert_equal(ticket.close_diff_in_min, 60, 'ticket.close_diff_in_min verify 7')
|
||||||
|
|
||||||
# set close time over time
|
# set close time over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
close_at: '2013-03-21 13:00:00 UTC',
|
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')
|
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')
|
assert_equal(ticket.close_diff_in_min, -30, 'ticket.close_diff_in_min verify 8')
|
||||||
|
|
||||||
# set close time over time
|
# set close time over time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
state: Ticket::State.lookup(name: 'closed')
|
state: Ticket::State.lookup(name: 'closed')
|
||||||
)
|
)
|
||||||
assert_nil(ticket.escalation_at, 'ticket.escalation_at verify 9')
|
assert_nil(ticket.escalation_at, 'ticket.escalation_at verify 9')
|
||||||
|
@ -1097,12 +1097,12 @@ class TicketSlaTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# set update time
|
# set update time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
last_contact_agent_at: '2013-06-04 10:15:00 UTC',
|
last_contact_agent_at: '2013-06-04 10:15:00 UTC',
|
||||||
)
|
)
|
||||||
|
|
||||||
# set first response time
|
# set first response time
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
first_response_at: '2013-06-04 10:45:00 UTC',
|
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'
|
updated_at: '2013-06-04 12:00:00 UTC'
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket.update_attributes(
|
ticket.update!(
|
||||||
close_at: '2013-06-04 12:00:00 UTC',
|
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',
|
created_at: '2013-06-04 12:00:00 UTC',
|
||||||
updated_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',
|
close_at: '2013-06-04 12:00:00 UTC',
|
||||||
)
|
)
|
||||||
ticket.escalation_calculation(true)
|
ticket.escalation_calculation(true)
|
||||||
|
@ -1346,7 +1346,7 @@ class TicketSlaTest < ActiveSupport::TestCase
|
||||||
created_at: '2013-06-04 12:00:00 UTC',
|
created_at: '2013-06-04 12:00:00 UTC',
|
||||||
updated_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',
|
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',
|
created_at: '2013-06-04 12:00:00 UTC',
|
||||||
updated_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',
|
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')
|
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
|
# set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 3:00-18:00
|
||||||
calendar.update_attributes(
|
calendar.update!(
|
||||||
business_hours: {
|
business_hours: {
|
||||||
mon: {
|
mon: {
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -1497,7 +1497,7 @@ class TicketTriggerTest < ActiveSupport::TestCase
|
||||||
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
||||||
assert_equal([], ticket1.tag_list)
|
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
|
UserInfo.current_user_id = agent.id
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
|
@ -1608,7 +1608,7 @@ class TicketTriggerTest < ActiveSupport::TestCase
|
||||||
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
||||||
assert_equal([], ticket1.tag_list)
|
assert_equal([], ticket1.tag_list)
|
||||||
|
|
||||||
ticket1.update_attribute(:customer, customer )
|
ticket1.update!(customer: customer )
|
||||||
|
|
||||||
UserInfo.current_user_id = agent.id
|
UserInfo.current_user_id = agent.id
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
|
|
|
@ -271,7 +271,7 @@ class UserTest < ActiveSupport::TestCase
|
||||||
assert_equal(test[:create_verify][:image_md5], file_md5, "create avatar md5 check in (#{test[:name]})")
|
assert_equal(test[:create_verify][:image_md5], file_md5, "create avatar md5 check in (#{test[:name]})")
|
||||||
end
|
end
|
||||||
if test[:update]
|
if test[:update]
|
||||||
user.update_attributes( test[:update] )
|
user.update!( test[:update] )
|
||||||
|
|
||||||
test[:update_verify].each { |key, value|
|
test[:update_verify].each { |key, value|
|
||||||
next if key == :image_md5
|
next if key == :image_md5
|
||||||
|
@ -848,18 +848,18 @@ class UserTest < ActiveSupport::TestCase
|
||||||
admin_count_inital = User.with_permissions('admin').count
|
admin_count_inital = User.with_permissions('admin').count
|
||||||
assert_equal(3, admin_count_inital)
|
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
|
admin_count_inital = User.with_permissions('admin').count
|
||||||
assert_equal(2, admin_count_inital)
|
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
|
admin_count_inital = User.with_permissions('admin').count
|
||||||
assert_equal(1, admin_count_inital)
|
assert_equal(1, admin_count_inital)
|
||||||
|
|
||||||
assert_raises(Exceptions::UnprocessableEntity) {
|
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
|
admin_count_inital = User.with_permissions('admin').count
|
||||||
|
|
Loading…
Reference in a new issue