- # Remove a node or way from all relations
- # This is only used by putway and deleteway when deleting nodes removed
- # from a way (because Potlatch itself doesn't keep track of these -
- # possible FIXME).
-
- def deleteitemrelations(user, changeset_id, objid, type, version) #:doc:
- relations = RelationMember.find(:all,
- :conditions => ['member_type = ? and member_id = ?', type.classify, objid],
- :include => :relation).collect { |rm| rm.relation }.uniq
-
- relations.each do |rel|
- rel.members.delete_if { |x| x[0] == type and x[1] == objid }
- new_rel = Relation.new
- new_rel.tags = rel.tags
- new_rel.visible = rel.visible
- new_rel.version = rel.version
- new_rel.members = rel.members
- new_rel.changeset_id = changeset_id
- rel.update_from(new_rel, user)
- end
- end
-