X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/df11677afd55ef592330a05c43ed4baa81b60572..ea1961e3ce54432e15a2468fb7b711937fd1517a:/app/models/way.rb diff --git a/app/models/way.rb b/app/models/way.rb index de69f7565..ea027fb47 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -199,6 +199,8 @@ class Way < ActiveRecord::Base def update_from(new_way, user) if !new_way.preconditions_ok? raise OSM::APIPreconditionFailedError.new + elsif new_way.version != version + raise OSM::APIVersionMismatchError.new(new_way.version, version) else self.user_id = user.id self.tags = new_way.tags @@ -219,8 +221,7 @@ class Way < ActiveRecord::Base return true end - # Delete the way and it's relations, but don't really delete it - set its visibility to false and update the history etc to maintain wiki-like functionality. - def delete_with_relations_and_history(user) + def delete_with_history(user) if self.visible # FIXME # this should actually delete the relations, @@ -244,6 +245,8 @@ class Way < ActiveRecord::Base end # delete a way and it's nodes that aren't part of other ways, with history + + # FIXME: merge the potlatch code to delete the relations def delete_with_relations_and_nodes_and_history(user) node_ids = self.nodes.collect {|node| node.id } @@ -264,7 +267,7 @@ class Way < ActiveRecord::Base self.user_id = user.id - self.delete_with_relations_and_history(user) + self.delete_with_history(user) end end