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

View file

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

View file

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