From 3c1744af0b66db46d7bea2536aa5235ba5b82998 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 27 Feb 2018 11:39:16 +0100 Subject: [PATCH] Fixed issue #1733: Can't un-link i-doit Objects in a Ticket. --- .../app/controllers/ticket_zoom/sidebar_idoit.coffee | 7 ++++++- app/controllers/integration/idoit_controller.rb | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_idoit.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_idoit.coffee index 931a5d39c..cdeb42e46 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_idoit.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_idoit.coffee @@ -22,7 +22,12 @@ class SidebarIdoit extends App.Controller container: @el.closest('.content') callback: (objectIds, objectSelectorUi) => if @ticket && @ticket.id - @updateTicket(@ticket.id, objectIds, => + + # add new objectIds to list of all @objectIds + # and transfer the complete list to the backend + @objectIds = @objectIds.concat(objectIds) + + @updateTicket(@ticket.id, @objectIds, => objectSelectorUi.close() @showObjectsContent(objectIds) ) diff --git a/app/controllers/integration/idoit_controller.rb b/app/controllers/integration/idoit_controller.rb index 39ea03361..7bfe3067a 100644 --- a/app/controllers/integration/idoit_controller.rb +++ b/app/controllers/integration/idoit_controller.rb @@ -40,8 +40,7 @@ class Integration::IdoitController < ApplicationController ticket = Ticket.find(params[:ticket_id]) access!(ticket, 'read') ticket.preferences[:idoit] ||= {} - ticket.preferences[:idoit][:object_ids] ||= [] - ticket.preferences[:idoit][:object_ids].concat(params[:object_ids]) + ticket.preferences[:idoit][:object_ids] = Array(params[:object_ids]).uniq ticket.save! render json: {