- # delete a way and it's nodes that aren't part of other ways, with history
- # WARNING, INCOMPLETE - Read the code
- def delete_with_relations_and_nodes_and_history(user)
- return false # until complete, just return false
-
- node_ids = self.nodes.collect {|node| node.id }
- node_ids_not_to_delete = []
- way_nodes = WayNode.find(:all, :conditions => "node_id in [#{node_ids.join(',')}] and id not #{self.id}")
-
- node_ids_not_to_delete = way_nodes.collect {|way_node| way_node.node_id}
-
- nodes_to_delete = node_ids - node_ids_not_to_delete
-
- # update the visibility etc on the current nodes
- update_time = Time.now()
+ # delete a way and its nodes that aren't part of other ways, with history
+
+ # FIXME: merge the potlatch code to delete the relations
+ # and refactor to use delete_with_history!
+ def delete_with_relations_and_nodes_and_history(changeset_id)
+ # delete the nodes not used by other ways
+ self.unshared_node_ids.each do |node_id|
+ n = Node.find(node_id)
+ n.changeset_id = changeset_id
+ n.visible = false
+ n.save_with_history!
+ end