Improved error handling.
This commit is contained in:
parent
57c1124a42
commit
45c4488b7d
3 changed files with 8 additions and 6 deletions
|
@ -13,11 +13,12 @@ class SidebarArticleAttachments extends App.Controller
|
||||||
showObjects: (el) =>
|
showObjects: (el) =>
|
||||||
@el = el
|
@el = el
|
||||||
|
|
||||||
if !@ticket || _.isEmpty(@ticket.article_ids)
|
if _.isEmpty(@ticket) || _.isEmpty(@ticket.article_ids)
|
||||||
@el.html("<div>#{App.i18n.translateInline('none')}</div>")
|
@el.html("<div>#{App.i18n.translateInline('none')}</div>")
|
||||||
return
|
return
|
||||||
html = ''
|
html = ''
|
||||||
for ticket_article_id, index in @ticket.article_ids
|
for ticket_article_id, index in @ticket.article_ids
|
||||||
|
if App.TicketArticle.exists(ticket_article_id)
|
||||||
article = App.TicketArticle.find(ticket_article_id)
|
article = App.TicketArticle.find(ticket_article_id)
|
||||||
attachments = App.TicketArticle.contentAttachments(article)
|
attachments = App.TicketArticle.contentAttachments(article)
|
||||||
if !_.isEmpty(attachments)
|
if !_.isEmpty(attachments)
|
||||||
|
|
|
@ -49,6 +49,7 @@ class App.TicketArticle extends App.Model
|
||||||
return "Unknow action for (#{@objectDisplayName()}/#{item.type}), extend activityMessage() of model."
|
return "Unknow action for (#{@objectDisplayName()}/#{item.type}), extend activityMessage() of model."
|
||||||
|
|
||||||
@contentAttachments: (article) ->
|
@contentAttachments: (article) ->
|
||||||
|
return [] if !article
|
||||||
return [] if !article.attachments
|
return [] if !article.attachments
|
||||||
attachments = []
|
attachments = []
|
||||||
for attachment in article.attachments
|
for attachment in article.attachments
|
||||||
|
|
|
@ -47,7 +47,7 @@ returns
|
||||||
local_attributes['member_ids'] = local_attributes['member_ids'].sort[0, 100]
|
local_attributes['member_ids'] = local_attributes['member_ids'].sort[0, 100]
|
||||||
end
|
end
|
||||||
local_attributes['member_ids'].each do |local_user_id|
|
local_attributes['member_ids'].each do |local_user_id|
|
||||||
next if data[ app_model_user ][ local_user_id ]
|
next if data[ app_model_user ] && data[ app_model_user ][ local_user_id ]
|
||||||
user = User.lookup(id: local_user_id)
|
user = User.lookup(id: local_user_id)
|
||||||
next if !user
|
next if !user
|
||||||
data = user.assets(data)
|
data = user.assets(data)
|
||||||
|
|
Loading…
Reference in a new issue