From 4be8f330b8ec9ff07b0593a7fcf029194cdb9c90 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 23 Oct 2014 20:08:00 +0200 Subject: [PATCH 1/3] Fixed removing of invalid session. --- lib/sessions.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/sessions.rb b/lib/sessions.rb index b0da69bcc..f1e4d236c 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -171,7 +171,7 @@ returns list_of_closed_sessions = [] clients = Sessions.list clients.each { |client_id, client| - if ( client[:meta][:last_ping].to_i + ( 60 * idle_time_in_min ) ) < Time.now.to_i + if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + ( 60 * idle_time_in_min ) ) < Time.now.to_i list_of_closed_sessions.push client_id Sessions.destory( client_id ) end @@ -223,9 +223,14 @@ returns =end def self.get( client_id ) - session_file = @path + '/' + client_id.to_s + '/session' + session_dir = @path + '/' + client_id.to_s + session_file = session_dir + '/session' data = nil - return if !File.exist? session_file + if !File.exist? session_file + FileUtils.rm_rf session_dir + puts "ERROR: missing session file for '#{client_id.to_s}', remove session." + return + end begin File.open( session_file, 'rb' ) { |file| file.flock( File::LOCK_EX ) @@ -234,9 +239,9 @@ returns data = Marshal.load( all ) } rescue Exception => e - File.delete(session_file) - puts "Error reading '#{session_file}':" puts e.inspect + FileUtils.rm_rf session_dir + puts "ERROR: reading session file '#{session_file}', remove session." return end data From 5980a39ea06c3124c1fbe230205b0722ec5a9e90 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 23 Oct 2014 21:41:32 +0200 Subject: [PATCH 2/3] Use api now to destroy invalid sessions. --- lib/sessions.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sessions.rb b/lib/sessions.rb index f1e4d236c..c4f89741c 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -142,7 +142,7 @@ returns destroy session - Sessions.destory?(client_id) + Sessions.destory(client_id) returns @@ -227,7 +227,7 @@ returns session_file = session_dir + '/session' data = nil if !File.exist? session_file - FileUtils.rm_rf session_dir + self.destory(client_id) puts "ERROR: missing session file for '#{client_id.to_s}', remove session." return end @@ -240,7 +240,7 @@ returns } rescue Exception => e puts e.inspect - FileUtils.rm_rf session_dir + self.destory(client_id) puts "ERROR: reading session file '#{session_file}', remove session." return end From 57271ffa721de569c1e1e4a30ca3627fd24d5a5b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 6 Nov 2014 07:54:43 +0100 Subject: [PATCH 3/3] Fixed resent of articles. --- .../javascripts/app/controllers/ticket_zoom.js.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index a8e3c9d6a..2f7211560 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -241,6 +241,10 @@ class TicketTitle extends App.Controller # update title @ticket.title = title + + # reset article - should not be resubmited on next ticket update + ticket.article = undefined + @ticket.save() # update taskbar with new meta data @@ -580,6 +584,9 @@ class Edit extends App.Controller ticket.save( done: (r) => + # reset article - should not be resubmited on next ticket update + ticket.article = undefined + # reset form after save App.TaskManager.update( @task_key, { 'state': {} })