From ceaf615282ccf81a0828d970ed94c84845187aae Mon Sep 17 00:00:00 2001 From: Julian K Date: Wed, 30 Nov 2016 11:30:03 +0100 Subject: [PATCH 1/2] Fix spelling mistake (#481) destory -> destroy --- .../app/controllers/network.coffee | 16 +++++++-------- .../app/lib/app_post/task_manager.coffee | 2 +- app/controllers/application_controller.rb | 6 +++--- app/controllers/calendars_controller.rb | 2 +- app/controllers/channels_controller.rb | 2 +- app/controllers/chats_controller.rb | 2 +- app/controllers/email_addresses_controller.rb | 2 +- .../external_credentials_controller.rb | 2 +- app/controllers/groups_controller.rb | 2 +- app/controllers/jobs_controller.rb | 2 +- app/controllers/macros_controller.rb | 2 +- .../object_manager_attributes_controller.rb | 2 +- .../online_notifications_controller.rb | 2 +- app/controllers/organizations_controller.rb | 2 +- app/controllers/overviews_controller.rb | 2 +- .../postmaster_filters_controller.rb | 2 +- app/controllers/report_profiles_controller.rb | 2 +- app/controllers/roles_controller.rb | 2 +- app/controllers/signatures_controller.rb | 2 +- app/controllers/slas_controller.rb | 2 +- app/controllers/taskbar_controller.rb | 2 +- app/controllers/templates_controller.rb | 2 +- app/controllers/text_modules_controller.rb | 2 +- .../ticket_priorities_controller.rb | 2 +- app/controllers/ticket_states_controller.rb | 2 +- app/controllers/translations_controller.rb | 2 +- app/controllers/triggers_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/models/application_model.rb | 2 +- lib/sessions.rb | 20 +++++++++---------- script/websocket-server.rb | 4 ++-- test/unit/session_basic_test.rb | 2 +- test/unit/session_enhanced_test.rb | 20 +++++++++---------- 33 files changed, 61 insertions(+), 61 deletions(-) diff --git a/app/assets/javascripts/app/controllers/network.coffee b/app/assets/javascripts/app/controllers/network.coffee index 43ea9b35d..e0c165635 100644 --- a/app/assets/javascripts/app/controllers/network.coffee +++ b/app/assets/javascripts/app/controllers/network.coffee @@ -2,19 +2,19 @@ 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' constructor: -> super - + # set title @title 'Network' @render() @navupdate '#network' - + render: -> networks = App.Network.all() network_categories = App.NetworkCategory.all() @@ -23,11 +23,11 @@ class Index extends App.ControllerContent 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( @@ -38,7 +38,7 @@ class Index extends App.ControllerContent success: => @render() ) - + network_edit: (e) -> e.preventDefault() @id = $(e.target).parents('[data-id]').data('id') @@ -51,8 +51,8 @@ class Index extends App.ControllerContent success: => @render() ) - - network_destory: (e) -> + + network_destroy: (e) -> e.preventDefault() id = $(e.target).parents('[data-id]').data('id') item = App.Network.find(id) diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.coffee index fb9331f66..3a8f33a84 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.coffee @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d6c2a8451..8c15eee59 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 184317030..01240e53d 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -36,7 +36,7 @@ class CalendarsController < ApplicationController end def destroy - model_destory_render(Calendar, params) + model_destroy_render(Calendar, params) end end diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index 371ba726c..818ac9525 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -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 diff --git a/app/controllers/chats_controller.rb b/app/controllers/chats_controller.rb index 607154cf8..ef7379105 100644 --- a/app/controllers/chats_controller.rb +++ b/app/controllers/chats_controller.rb @@ -31,7 +31,7 @@ class ChatsController < ApplicationController end def destroy - model_destory_render(Chat, params) + model_destroy_render(Chat, params) end end diff --git a/app/controllers/email_addresses_controller.rb b/app/controllers/email_addresses_controller.rb index e7a8433a1..22ccf94cc 100644 --- a/app/controllers/email_addresses_controller.rb +++ b/app/controllers/email_addresses_controller.rb @@ -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 diff --git a/app/controllers/external_credentials_controller.rb b/app/controllers/external_credentials_controller.rb index 66b0445ad..8e25702fb 100644 --- a/app/controllers/external_credentials_controller.rb +++ b/app/controllers/external_credentials_controller.rb @@ -20,7 +20,7 @@ class ExternalCredentialsController < ApplicationController end def destroy - model_destory_render(ExternalCredential, params) + model_destroy_render(ExternalCredential, params) end def app_verify diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index a20c9c786..a1abb05d2 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -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 diff --git a/app/controllers/jobs_controller.rb b/app/controllers/jobs_controller.rb index b0233a7aa..660d6c2b8 100644 --- a/app/controllers/jobs_controller.rb +++ b/app/controllers/jobs_controller.rb @@ -20,7 +20,7 @@ class JobsController < ApplicationController end def destroy - model_destory_render(Job, params) + model_destroy_render(Job, params) end end diff --git a/app/controllers/macros_controller.rb b/app/controllers/macros_controller.rb index a8f4f1d68..01ce8e0b7 100644 --- a/app/controllers/macros_controller.rb +++ b/app/controllers/macros_controller.rb @@ -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 diff --git a/app/controllers/object_manager_attributes_controller.rb b/app/controllers/object_manager_attributes_controller.rb index 185af695b..066fd76d7 100644 --- a/app/controllers/object_manager_attributes_controller.rb +++ b/app/controllers/object_manager_attributes_controller.rb @@ -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 diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index 0565e7d82..3e2a5f80f 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -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 diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index bdf5322fb..0932fb9ec 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -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 diff --git a/app/controllers/overviews_controller.rb b/app/controllers/overviews_controller.rb index f082a1383..bfff62ae7 100644 --- a/app/controllers/overviews_controller.rb +++ b/app/controllers/overviews_controller.rb @@ -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 diff --git a/app/controllers/postmaster_filters_controller.rb b/app/controllers/postmaster_filters_controller.rb index 391eb44e1..3986221b4 100644 --- a/app/controllers/postmaster_filters_controller.rb +++ b/app/controllers/postmaster_filters_controller.rb @@ -175,6 +175,6 @@ Test: =end def destroy - model_destory_render(PostmasterFilter, params) + model_destroy_render(PostmasterFilter, params) end end diff --git a/app/controllers/report_profiles_controller.rb b/app/controllers/report_profiles_controller.rb index f88933fd2..48221a225 100644 --- a/app/controllers/report_profiles_controller.rb +++ b/app/controllers/report_profiles_controller.rb @@ -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 diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 569f9b531..560d95195 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -137,6 +137,6 @@ Test: =end def destroy - model_destory_render(Role, params) + model_destroy_render(Role, params) end end diff --git a/app/controllers/signatures_controller.rb b/app/controllers/signatures_controller.rb index 0aa7476aa..88359225c 100644 --- a/app/controllers/signatures_controller.rb +++ b/app/controllers/signatures_controller.rb @@ -143,6 +143,6 @@ Test: def destroy permission_check(['admin.channel_email']) - model_destory_render(Signature, params) + model_destroy_render(Signature, params) end end diff --git a/app/controllers/slas_controller.rb b/app/controllers/slas_controller.rb index 0439ee904..160281f22 100644 --- a/app/controllers/slas_controller.rb +++ b/app/controllers/slas_controller.rb @@ -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 diff --git a/app/controllers/taskbar_controller.rb b/app/controllers/taskbar_controller.rb index 635a18177..bbd6703db 100644 --- a/app/controllers/taskbar_controller.rb +++ b/app/controllers/taskbar_controller.rb @@ -34,7 +34,7 @@ class TaskbarController < ApplicationController access(taskbar) taskbar.destroy - model_destory_render_item() + model_destroy_render_item() end private diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index e769e638d..5b3fef692 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -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 diff --git a/app/controllers/text_modules_controller.rb b/app/controllers/text_modules_controller.rb index ecf8d12cf..46b038b2c 100644 --- a/app/controllers/text_modules_controller.rb +++ b/app/controllers/text_modules_controller.rb @@ -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 diff --git a/app/controllers/ticket_priorities_controller.rb b/app/controllers/ticket_priorities_controller.rb index d0fab507c..4d14af2df 100644 --- a/app/controllers/ticket_priorities_controller.rb +++ b/app/controllers/ticket_priorities_controller.rb @@ -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 diff --git a/app/controllers/ticket_states_controller.rb b/app/controllers/ticket_states_controller.rb index 2d7b6f128..fa66a8376 100644 --- a/app/controllers/ticket_states_controller.rb +++ b/app/controllers/ticket_states_controller.rb @@ -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 diff --git a/app/controllers/translations_controller.rb b/app/controllers/translations_controller.rb index 274b6fd18..d58353a54 100644 --- a/app/controllers/translations_controller.rb +++ b/app/controllers/translations_controller.rb @@ -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 diff --git a/app/controllers/triggers_controller.rb b/app/controllers/triggers_controller.rb index 4b51aa250..a353f7b03 100644 --- a/app/controllers/triggers_controller.rb +++ b/app/controllers/triggers_controller.rb @@ -20,7 +20,7 @@ class TriggersController < ApplicationController end def destroy - model_destory_render(Trigger, params) + model_destroy_render(Trigger, params) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2311e10f5..be9db09a3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 77d4a7c7a..51d4426a4 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -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 diff --git a/lib/sessions.rb b/lib/sessions.rb index 21e55e3fe..f2bfb4950 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -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 diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 541aba103..7affdb355 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -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 } diff --git a/test/unit/session_basic_test.rb b/test/unit/session_basic_test.rb index 307fe140e..440afcae6 100644 --- a/test/unit/session_basic_test.rb +++ b/test/unit/session_basic_test.rb @@ -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') diff --git a/test/unit/session_enhanced_test.rb b/test/unit/session_enhanced_test.rb index adcc85daa..e9f1dc99f 100644 --- a/test/unit/session_enhanced_test.rb +++ b/test/unit/session_enhanced_test.rb @@ -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') From 1736ac9a70f614df12cea693a802ef72ed056e08 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 30 Nov 2016 11:33:38 +0100 Subject: [PATCH 2/2] Fixed travis race condition issue. --- test/unit/ticket_overview_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/ticket_overview_test.rb b/test/unit/ticket_overview_test.rb index 44476dd4b..c31952e26 100644 --- a/test/unit/ticket_overview_test.rb +++ b/test/unit/ticket_overview_test.rb @@ -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'),