Martin Edenhofer 6 лет назад
Родитель
Сommit
45c4488b7d

+ 6 - 5
app/assets/javascripts/app/controllers/ticket_zoom/sidebar_article_attachments.coffee

@@ -13,15 +13,16 @@ class SidebarArticleAttachments extends App.Controller
   showObjects: (el) =>
     @el = el
 
-    if !@ticket || _.isEmpty(@ticket.article_ids)
+    if _.isEmpty(@ticket) || _.isEmpty(@ticket.article_ids)
       @el.html("<div>#{App.i18n.translateInline('none')}</div>")
       return
     html = ''
     for ticket_article_id, index in @ticket.article_ids
-      article = App.TicketArticle.find(ticket_article_id)
-      attachments = App.TicketArticle.contentAttachments(article)
-      if !_.isEmpty(attachments)
-        html = App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments) + html
+      if App.TicketArticle.exists(ticket_article_id)
+        article = App.TicketArticle.find(ticket_article_id)
+        attachments = App.TicketArticle.contentAttachments(article)
+        if !_.isEmpty(attachments)
+          html = App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments) + html
     @el.html(html)
     @el.delegate('.js-attachments img', 'click', (e) =>
       @imageView(e)

+ 1 - 0
app/assets/javascripts/app/models/ticket_article.coffee

@@ -49,6 +49,7 @@ class App.TicketArticle extends App.Model
     return "Unknow action for (#{@objectDisplayName()}/#{item.type}), extend activityMessage() of model."
 
   @contentAttachments: (article) ->
+    return [] if !article
     return [] if !article.attachments
     attachments = []
     for attachment in article.attachments

+ 1 - 1
app/models/organization/assets.rb

@@ -47,7 +47,7 @@ returns
             local_attributes['member_ids'] = local_attributes['member_ids'].sort[0, 100]
           end
           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)
             next if !user
             data = user.assets(data)