Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
André Bauer 2016-11-30 11:35:32 +01:00
commit 547277e675
34 changed files with 62 additions and 61 deletions

View file

@ -2,7 +2,7 @@ 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_destory'
'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'
@ -52,7 +52,7 @@ class Index extends App.ControllerContent
@render()
)
network_destory: (e) ->
network_destroy: (e) ->
e.preventDefault()
id = $(e.target).parents('[data-id]').data('id')
item = App.Network.find(id)

View file

@ -544,7 +544,7 @@ class _taskManagerSingleton extends App.Controller
)
return
# destory task in backend
# destroy task in backend
delete @tasksToUpdate[ task.key ]
# if task isnt already stored on backend

View file

@ -561,13 +561,13 @@ class ApplicationController < ActionController::Base
render json: generic_object.attributes_with_associations, status: :ok
end
def model_destory_render(object, params)
def model_destroy_render(object, params)
generic_object = object.find(params[:id])
generic_object.destroy!
model_destory_render_item()
model_destroy_render_item()
end
def model_destory_render_item ()
def model_destroy_render_item ()
render json: {}, status: :ok
end

View file

@ -36,7 +36,7 @@ class CalendarsController < ApplicationController
end
def destroy
model_destory_render(Calendar, params)
model_destroy_render(Calendar, params)
end
end

View file

@ -42,7 +42,7 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
def destroy
permission_check('admin')
check_access
model_destory_render(Channel, params)
model_destroy_render(Channel, params)
end
def twitter_index

View file

@ -31,7 +31,7 @@ class ChatsController < ApplicationController
end
def destroy
model_destory_render(Chat, params)
model_destroy_render(Chat, params)
end
end

View file

@ -149,6 +149,6 @@ curl http://localhost/api/v1/email_addresses/#{id}.json -v -u #{login}:#{passwor
def destroy
permission_check('admin.channel_email')
model_destory_render(EmailAddress, params)
model_destroy_render(EmailAddress, params)
end
end

View file

@ -20,7 +20,7 @@ class ExternalCredentialsController < ApplicationController
end
def destroy
model_destory_render(ExternalCredential, params)
model_destroy_render(ExternalCredential, params)
end
def app_verify

View file

@ -149,6 +149,6 @@ curl http://localhost/api/v1/groups/{id} -v -u #{login}:#{password} -H "Content-
=end
def destroy
model_destory_render(Group, params)
model_destroy_render(Group, params)
end
end

View file

@ -20,7 +20,7 @@ class JobsController < ApplicationController
end
def destroy
model_destory_render(Job, params)
model_destroy_render(Job, params)
end
end

View file

@ -150,6 +150,6 @@ curl http://localhost/api/v1/macros.json -v -u #{login}:#{password} -H "Content-
=end
def destroy
model_destory_render(Macro, params)
model_destroy_render(Macro, params)
end
end

View file

@ -77,7 +77,7 @@ class ObjectManagerAttributesController < ApplicationController
object_lookup_id: object_manager_attribute.object_lookup_id,
name: object_manager_attribute.name,
)
model_destory_render_item
model_destroy_render_item
end
# POST /object_manager_attributes_discard_changes

View file

@ -99,7 +99,7 @@ curl http://localhost/api/v1/online_notifications/{id}.json -v -u #{login}:#{pas
def destroy
return if !access?
model_destory_render(OnlineNotification, params)
model_destroy_render(OnlineNotification, params)
end
=begin

View file

@ -216,7 +216,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
def destroy
permission_check('ticket.agent')
model_references_check(Organization, params)
model_destory_render(Organization, params)
model_destroy_render(Organization, params)
end
# GET /api/v1/organizations/search

View file

@ -156,6 +156,6 @@ curl http://localhost/api/v1/overviews/#{id}.json -v -u #{login}:#{password} -H
=end
def destroy
model_destory_render(Overview, params)
model_destroy_render(Overview, params)
end
end

View file

@ -175,6 +175,6 @@ Test:
=end
def destroy
model_destory_render(PostmasterFilter, params)
model_destroy_render(PostmasterFilter, params)
end
end

View file

@ -136,7 +136,7 @@ curl http://localhost/api/report_profiles.json -v -u #{login}:#{password} -H "Co
=end
def destroy
model_destory_render(Report::Profile, params)
model_destroy_render(Report::Profile, params)
end
end

View file

@ -137,6 +137,6 @@ Test:
=end
def destroy
model_destory_render(Role, params)
model_destroy_render(Role, params)
end
end

View file

@ -143,6 +143,6 @@ Test:
def destroy
permission_check(['admin.channel_email'])
model_destory_render(Signature, params)
model_destroy_render(Signature, params)
end
end

View file

@ -164,7 +164,7 @@ curl http://localhost/api/v1/slas.json -v -u #{login}:#{password} -H "Content-Ty
=end
def destroy
model_destory_render(Sla, params)
model_destroy_render(Sla, params)
end
end

View file

@ -34,7 +34,7 @@ class TaskbarController < ApplicationController
access(taskbar)
taskbar.destroy
model_destory_render_item()
model_destroy_render_item()
end
private

View file

@ -144,6 +144,6 @@ curl http://localhost/api/v1/templates.json -v -u #{login}:#{password} -H "Conte
def destroy
permission_check(['admin.template', 'ticket.agent'])
model_destory_render(Template, params)
model_destroy_render(Template, params)
end
end

View file

@ -150,6 +150,6 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co
def destroy
permission_check('admin.text_module')
model_destory_render(TextModule, params)
model_destroy_render(TextModule, params)
end
end

View file

@ -31,6 +31,6 @@ class TicketPrioritiesController < ApplicationController
def destroy
permission_check('admin.object')
model_references_check(Ticket::Priority, params)
model_destory_render(Ticket::Priority, params)
model_destroy_render(Ticket::Priority, params)
end
end

View file

@ -31,6 +31,6 @@ class TicketStatesController < ApplicationController
def destroy
permission_check('admin.object')
return if model_references_check(Ticket::State, params)
model_destory_render(Ticket::State, params)
model_destroy_render(Ticket::State, params)
end
end

View file

@ -66,6 +66,6 @@ class TranslationsController < ApplicationController
# DELETE /translations/1
def destroy
permission_check('admin.translation')
model_destory_render(Translation, params)
model_destroy_render(Translation, params)
end
end

View file

@ -20,7 +20,7 @@ class TriggersController < ApplicationController
end
def destroy
model_destory_render(Trigger, params)
model_destroy_render(Trigger, params)
end
end

View file

@ -303,7 +303,7 @@ class UsersController < ApplicationController
def destroy
permission_check('admin.user')
model_references_check(User, params)
model_destory_render(User, params)
model_destroy_render(User, params)
end
# @path [GET] /users/me

View file

@ -1591,7 +1591,7 @@ check string/varchar size and cut them if needed
=begin
destory object dependencies, will be executed automatically
destroy object dependencies, will be executed automatically
=end

View file

@ -46,9 +46,9 @@ returns
file.write content
}
# destory old session if needed
# destroy old session if needed
if File.exist?(path)
Sessions.destory(client_id)
Sessions.destroy(client_id)
end
# move to destination directory
@ -160,7 +160,7 @@ returns
destroy session
Sessions.destory(client_id)
Sessions.destroy(client_id)
returns
@ -168,7 +168,7 @@ returns
=end
def self.destory(client_id)
def self.destroy(client_id)
path = "#{@path}/#{client_id}"
FileUtils.rm_rf path
end
@ -177,7 +177,7 @@ returns
destroy idle session
list_of_client_ids = Sessions.destory_idle_sessions
list_of_client_ids = Sessions.destroy_idle_sessions
returns
@ -185,13 +185,13 @@ returns
=end
def self.destory_idle_sessions(idle_time_in_sec = 240)
def self.destroy_idle_sessions(idle_time_in_sec = 240)
list_of_closed_sessions = []
clients = Sessions.list
clients.each { |client_id, client|
if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + idle_time_in_sec ) < Time.now.utc.to_i
list_of_closed_sessions.push client_id
Sessions.destory(client_id)
Sessions.destroy(client_id)
end
}
list_of_closed_sessions
@ -248,14 +248,14 @@ returns
# if no session dir exists, session got destoried
if !File.exist? session_dir
destory(client_id)
destroy(client_id)
log('debug', "missing session directory for '#{client_id}', remove session.")
return
end
# if only session file is missing, then it's an error behavior
if !File.exist? session_file
destory(client_id)
destroy(client_id)
log('error', "missing session file for '#{client_id}', remove session.")
return
end
@ -272,7 +272,7 @@ returns
}
rescue => e
log('error', e.inspect)
destory(client_id)
destroy(client_id)
log('error', "error in reading/parsing session file '#{session_file}', remove session.")
return
end

View file

@ -128,7 +128,7 @@ EventMachine.run {
@clients.delete client_id
end
Sessions.destory(client_id)
Sessions.destroy(client_id)
}
# manage messages
@ -277,7 +277,7 @@ EventMachine.run {
}
# close unused ajax long polling sessions
clients = Sessions.destory_idle_sessions(idle_time_in_sec)
clients = Sessions.destroy_idle_sessions(idle_time_in_sec)
clients.each { |client_id|
log 'notice', 'closing idle long polling connection', client_id
}

View file

@ -98,7 +98,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal(data[:user]['id'], agent1.id, 'check if user id is correct')
# destroy session
Sessions.destory(client_id1)
Sessions.destroy(client_id1)
# check if session exists
assert(!Sessions.session_exists?(client_id1), 'check if session exists')

View file

@ -50,9 +50,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
client_id1 = '1234'
client_id2 = '123456'
client_id3 = 'abc'
Sessions.destory(client_id1)
Sessions.destory(client_id2)
Sessions.destory(client_id3)
Sessions.destroy(client_id1)
Sessions.destroy(client_id2)
Sessions.destroy(client_id3)
Sessions.create(client_id1, agent1.attributes, { type: 'websocket' })
Sessions.create(client_id2, agent2.attributes, { type: 'ajax' })
Sessions.create(client_id3, agent3.attributes, { type: 'ajax' })
@ -64,7 +64,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup
sleep 1
Sessions.destory_idle_sessions(3)
Sessions.destroy_idle_sessions(3)
assert(Sessions.session_exists?(client_id1), 'check if session exists after 1 sec')
assert(Sessions.session_exists?(client_id2), 'check if session exists after 1 sec')
assert(Sessions.session_exists?(client_id3), 'check if session exists after 1 sec')
@ -74,7 +74,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
Sessions.touch(client_id1)
Sessions.touch(client_id2)
Sessions.touch(client_id3)
Sessions.destory_idle_sessions(3)
Sessions.destroy_idle_sessions(3)
assert(Sessions.session_exists?(client_id1), 'check if session exists after touch')
assert(Sessions.session_exists?(client_id2), 'check if session exists after touch')
assert(Sessions.session_exists?(client_id3), 'check if session exists after touch')
@ -155,7 +155,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup
sleep 4
client_ids = Sessions.destory_idle_sessions(3)
client_ids = Sessions.destroy_idle_sessions(3)
# check client sessions
assert(!Sessions.session_exists?(client_id1), 'check if session is removed')
@ -216,9 +216,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
client_id1_0 = '1234-1'
client_id1_1 = '1234-2'
client_id2 = '123456'
Sessions.destory(client_id1_0)
Sessions.destory(client_id1_1)
Sessions.destory(client_id2)
Sessions.destroy(client_id1_0)
Sessions.destroy(client_id1_1)
Sessions.destroy(client_id2)
# start jobs
jobs = Thread.new {
@ -281,7 +281,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
# check if session still exists after idle cleanup
sleep 4
client_ids = Sessions.destory_idle_sessions(3)
client_ids = Sessions.destroy_idle_sessions(3)
# check client sessions
assert(!Sessions.session_exists?(client_id1_0), 'check if session is removed')

View file

@ -548,6 +548,7 @@ class TicketOverviewTest < ActiveSupport::TestCase
assert_equal(result[2][:tickets].class, Array)
assert(result[2][:tickets].empty?)
sleep 1
ticket3 = Ticket.create(
title: 'overview test 3',
group: Group.lookup(name: 'OverviewTest'),