- if (item.class == Link and
- item.link_class == 'name' and
- item.tail_uuid == @object.uuid)
- # Given uuid is a name link, linking an object to this
- # project. First follow the link to find the item we're removing,
- # then delete the link.
- 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
-
- # If this object has the 'expires_at' attribute, then simply mark it
- # expired.
- if item.attributes.include?("expires_at")
- item.update_attributes expires_at: Time.now
+ if item.class == Collection or item.class == Group
+ # Use delete API on collections and projects/groups
+ item.destroy