diff --git a/app/assets/javascripts/app/lib/app_post/overview_list_collection.coffee b/app/assets/javascripts/app/lib/app_post/overview_list_collection.coffee index b58ad30f1..d06c54f45 100644 --- a/app/assets/javascripts/app/lib/app_post/overview_list_collection.coffee +++ b/app/assets/javascripts/app/lib/app_post/overview_list_collection.coffee @@ -6,6 +6,9 @@ class _Singleton @counter = 0 App.Event.bind 'ticket_overview_list', (data) => + if data.assets + App.Collection.loadAssets(data.assets) + delete data.assets if !@overview[data.overview.view] @overview[data.overview.view] = {} @overview[data.overview.view] = data @@ -54,6 +57,7 @@ class _Singleton @fetchActive[view] = false if data.assets App.Collection.loadAssets(data.assets) + delete data.assets @overview[data.index.overview.view] = data.index @callback(view, data.index) error: => diff --git a/lib/sessions/backend/ticket_overview_list.rb b/lib/sessions/backend/ticket_overview_list.rb index bf80cbda4..220936de0 100644 --- a/lib/sessions/backend/ticket_overview_list.rb +++ b/lib/sessions/backend/ticket_overview_list.rb @@ -89,27 +89,28 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base # push overviews results = [] - index_and_lists.each { |index| + index_and_lists.each { |data| # do not deliver unchanged lists - next if @last_overview[index[:overview][:id]] == index - @last_overview[index[:overview][:id]] = index + next if @last_overview[data[:overview][:id]] == data + @last_overview[data[:overview][:id]] = data assets = {} - overview = Overview.lookup(id: index[:overview][:id]) + overview = Overview.lookup(id: data[:overview][:id]) if asset_needed?(overview) assets = overview.assets(assets) end - index[:tickets].each { |ticket_meta| + data[:tickets].each { |ticket_meta| ticket = Ticket.lookup(id: ticket_meta[:id]) next if !asset_needed?(ticket) assets = ticket.assets(assets) } + data[:assets] = assets if !@client result = { event: 'ticket_overview_list', - data: index, + data: data, } results.push result else @@ -117,13 +118,9 @@ class Sessions::Backend::TicketOverviewList < Sessions::Backend::Base @client.log "push overview_list #{overview.link} for user #{@user.id}" # send update to browser - @client.send( - event: 'loadAssets', - data: assets, - ) @client.send( event: 'ticket_overview_list', - data: index, + data: data, ) end }