Fixed issue #1733: Can't un-link i-doit Objects in a Ticket.

This commit is contained in:
Thorsten Eckel 2018-02-27 11:39:16 +01:00
parent db9d0a0eae
commit 3c1744af0b
2 changed files with 7 additions and 3 deletions

View file

@ -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)
)

View file

@ -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: {