Fixed race conditions.

This commit is contained in:
Martin Edenhofer 2013-08-21 01:54:16 +02:00
parent 07677f297c
commit aeb288d5e5
3 changed files with 26 additions and 22 deletions

View file

@ -57,7 +57,12 @@ class App.TicketCreate extends App.Controller
meta: =>
text = App.i18n.translateInline( @article_attributes['title'] )
subject = @el.find('[name=subject]').val()
if !@_initMetaDone
@_initMetaDone = true
state = App.TaskManager.get(@task_key).state
subject = state['subject']
else
subject = @el.find('[name=subject]').val()
if subject
text = "#{text}: #{subject}"
meta =

View file

@ -35,16 +35,18 @@ class App.TicketZoom extends App.Controller
)
meta: =>
return if !@ticket
ticket = App.Ticket.retrieve( @ticket.id )
meta =
url: @url()
head: ticket.title
title: '#' + ticket.number + ' - ' + ticket.title
id: ticket.id
head: '???'
title: '???'
id: @ticket_id
if @ticket
meta.head = @ticket.title
meta.title = '#' + @ticket.number + ' - ' + @ticket.title
meta
url: =>
'#ticket/zoom/' + @ticket.id
'#ticket/zoom/' + @ticket_id
activate: =>
@navupdate '#'
@ -106,9 +108,6 @@ class App.TicketZoom extends App.Controller
load: (data, force) =>
# reset old indexes
@ticket = undefined
# remember article ids
@ticket_article_ids = data.ticket_article_ids
@ -121,14 +120,14 @@ class App.TicketZoom extends App.Controller
# load collections
App.Event.trigger 'loadAssets', data.assets
# get data
@ticket = App.Ticket.retrieve( @ticket_id )
# render page
@render(force)
render: (force) =>
# get data
@ticket = App.Ticket.retrieve( @ticket_id )
# update taskbar with new meta data
App.Event.trigger 'task:render'
if !@renderDone

View file

@ -371,18 +371,18 @@ class _taskManagerSingleton extends App.Controller
# reopen tasks
App.Event.trigger 'taskbar:init'
task_count = 1
task_count = 0
for task in @allTasks
task_count += 1
console.log('START', task)
App.Delay.set(
=>
task = tasks.shift()
@add(task.key, task.callback, task.params, true)
task_count * 300
undefined
'task'
)
do (task) =>
App.Delay.set(
=>
@add(task.key, task.callback, task.params, true)
task_count * 300
undefined
'task'
)
App.Event.trigger 'taskbar:ready'