From 075aade8a8ae7af049963c6b52d1c4a6b1344287 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 4 Apr 2014 11:24:16 +0200 Subject: [PATCH] Improved reload trigger if somebody else changed ticket. --- app/assets/javascripts/app/controllers/ticket_zoom.js.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 4b689544a..880be8b87 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -27,9 +27,8 @@ class App.TicketZoom extends App.Controller (data) => update = => if data.id.toString() is @ticket_id.toString() - ticket = App.Ticket.find( @ticket_id ) - @log 'notice', 'TRY', Date(data.updated_at), Date(ticket.updated_at) - if Date(data.updated_at) isnt Date(ticket.updated_at) + @log 'notice', 'TRY', new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall) + if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() ) @fetch( @ticket_id, false ) @delay( update, 1800, 'ticket-zoom-' + @ticket_id ) )