X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/02b233b2eb80de1b234f3658d86a0e446e33a032..e1d71c83e17ba6d06e2442ed775f7efd4ea32d84:/apps/workbench/app/controllers/folders_controller.rb?ds=sidebyside diff --git a/apps/workbench/app/controllers/folders_controller.rb b/apps/workbench/app/controllers/folders_controller.rb index e0ac625bab..86ee42b10d 100644 --- a/apps/workbench/app/controllers/folders_controller.rb +++ b/apps/workbench/app/controllers/folders_controller.rb @@ -9,6 +9,7 @@ class FoldersController < ApplicationController def remove_item @removed_uuids = [] + links = [] item = ArvadosBase.find params[:item_uuid] if (item.class == Link and item.link_class == 'name' and @@ -16,8 +17,15 @@ class FoldersController < ApplicationController # Given uuid is a name link, linking an object to this # folder. First follow the link to find the item we're removing, # then delete the link. - link = item - item = ArvadosBase.find link.head_uuid + links << item + item = ArvadosBase.find item.head_uuid + else + # Given uuid is an object. Delete all names. + links += Link.where(tail_uuid: @object.uuid, + head_uuid: item.uuid, + link_class: 'name') + end + links.each do |link| @removed_uuids << link.uuid link.destroy end @@ -57,7 +65,6 @@ class FoldersController < ApplicationController @shared_with_me << folder end end - @object end def show