From 567025bd0afd34dd1857e9045918c0a07e311e39 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 5 Apr 2016 01:02:47 +0200 Subject: [PATCH] Improved error handling. --- .../app/controllers/_application_controller_generic.coffee | 2 -- app/assets/javascripts/app/controllers/logout.coffee | 2 +- app/assets/javascripts/app/models/ticket.coffee | 2 ++ app/assets/javascripts/app/models/ticket_article.coffee | 2 ++ test/browser/agent_ticket_actions_level2_test.rb | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee index 8214e5595..5e4ace903 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee @@ -846,7 +846,6 @@ class App.CollectionController extends App.Controller @lastOrder = newOrder collectionSync: (items, type) => - console.log('collectionSync', items, type) # remove items if type is 'destroy' @@ -1031,7 +1030,6 @@ class App.CollectionController extends App.Controller position = item.meta_position if itemCount > position position += 1 - console.log('!el', item, position, item.meta_position, @el.find(".js-item:nth-child(#{position})")) element = @el.find(".js-item:nth-child(#{position})") if @insertPosition is 'before' element.before(html) diff --git a/app/assets/javascripts/app/controllers/logout.coffee b/app/assets/javascripts/app/controllers/logout.coffee index fcc0fd8bb..339e53752 100644 --- a/app/assets/javascripts/app/controllers/logout.coffee +++ b/app/assets/javascripts/app/controllers/logout.coffee @@ -10,7 +10,7 @@ class Index extends App.ControllerContent # remove local session @Session.init() - App.Event.trigger( 'ui:rerender' ) + App.Event.trigger('ui:rerender') # redirect to login redirect = => diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index 053c50254..9720b7786 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -67,6 +67,7 @@ class App.Ticket extends App.Model "task-state-#{ @getState() }-color" iconActivity: (user) -> + return if !user if @owner_id == user.id return 'important' '' @@ -79,6 +80,7 @@ class App.Ticket extends App.Model iconClass: @getState() activityMessage: (item) -> + return if !item if item.type is 'create' return App.i18n.translateContent('%s created Ticket |%s|', item.created_by.displayName(), item.title) else if item.type is 'update' diff --git a/app/assets/javascripts/app/models/ticket_article.coffee b/app/assets/javascripts/app/models/ticket_article.coffee index 881e0433d..736a2b785 100644 --- a/app/assets/javascripts/app/models/ticket_article.coffee +++ b/app/assets/javascripts/app/models/ticket_article.coffee @@ -34,12 +34,14 @@ class App.TicketArticle extends App.Model '???' iconActivity: (user) -> + return if !user ticket = App.Ticket.find(@ticket_id) if ticket.owner_id == user.id return 'important' '' activityMessage: (item) -> + return if !item if item.type is 'create' return App.i18n.translateContent('%s created Article for |%s|', item.created_by.displayName(), item.title) else if item.type is 'update' diff --git a/test/browser/agent_ticket_actions_level2_test.rb b/test/browser/agent_ticket_actions_level2_test.rb index 8e5063bf9..7df40ad20 100644 --- a/test/browser/agent_ticket_actions_level2_test.rb +++ b/test/browser/agent_ticket_actions_level2_test.rb @@ -249,7 +249,7 @@ class AgentTicketActionsLevel2Test < TestCase ticket_update( browser: browser1, data: { - body: 'some update 4711', + body: 'some update 4711/2', }, ) sleep 4