Fixed ticket reload on server change.

This commit is contained in:
Martin Edenhofer 2015-02-01 12:43:59 +01:00
parent 0f8c093bec
commit 392dd59dc4

View file

@ -34,11 +34,15 @@ class App.TicketZoom extends App.Controller
@bind(
'Ticket:update'
(data) =>
update = =>
# check if current ticket has changed
if data.id.toString() is @ticket_id.toString()
@log 'notice', 'TRY', new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
# check if we already have the request queued
#@log 'notice', 'TRY', @ticket_id, new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
update = =>
@fetch( @ticket_id, false )
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
@delay( update, 1800, 'ticket-zoom-' + @ticket_id )
)
@ -264,7 +268,6 @@ class App.TicketZoom extends App.Controller
)
show = (ticket) =>
console.log('SHOW', ticket.id)
el.find('.edit').html('')
defaults = ticket.attributes()