Browse Source

Follow up 92b7c398797deec96a3828e4613c1ed2448c0889 - Fixes #3930 - Make sidebar attachments unique.

Rolf Schmidt 3 years ago
parent
commit
c1ae526ac0

+ 8 - 3
app/assets/javascripts/app/controllers/ticket_zoom/sidebar_article_attachments.coffee

@@ -1,4 +1,12 @@
 class SidebarArticleAttachments extends App.Controller
+  constructor: ->
+    super
+    @controllerBind('ui::ticket::load', (data) =>
+      return if data.ticket_id.toString() isnt @ticket.id.toString()
+      return if !@el
+      @showObjects(@el)
+    )
+
   sidebarItem: =>
     return if !@Config.get('ui_ticket_zoom_sidebar_article_attachments')
     @item = {
@@ -43,9 +51,6 @@ class SidebarArticleAttachments extends App.Controller
     @el.on('click', '.js-attachments img', (e) =>
       @imageView(e)
     )
-    @controllerBind('ui::ticket::load', =>
-      @showObjects(el)
-    )
 
   imageView: (e) ->
     e.preventDefault()