some useful notes in code for ideas that require implementing.

This commit is contained in:
Shaun McDonald 2008-10-07 23:49:53 +00:00
parent 6bf25141de
commit 2347761266
3 changed files with 18 additions and 1 deletions

View file

@ -87,6 +87,11 @@ class NodeController < ApplicationController
def delete
begin
node = Node.find(params[:id])
# FIXME we no longer care about the user, (or maybe we want to check
# that the user of the changeset is the same user as is making this
# little change?) we really care about the
# changeset which must be open, and that the version that we have been
# given is the one that is currently stored in the database
node.delete_with_history(@user)
render :nothing => true

View file

@ -11,6 +11,15 @@ class Changeset < ActiveRecord::Base
has_many :old_nodes
has_many :old_ways
has_many :old_relations
validates_presence_of :user_id, :created_at, :open
# Use a method like this, so that we can easily change how we
# determine whether a changeset is open, without breaking code in at
# least 6 controllers
def is_open?
return open
end
def self.from_xml(xml, create=false)
begin
@ -83,6 +92,7 @@ class Changeset < ActiveRecord::Base
doc.root << to_xml_node()
return doc
end
def to_xml_node(user_display_name_cache = nil)
el1 = XML::Node.new 'changeset'
el1['id'] = self.id.to_s

View file

@ -15,7 +15,9 @@ class NodeControllerTest < Test::Unit::TestCase
def test_create
# cannot read password from fixture as it is stored as MD5 digest
basic_authorization("test@openstreetmap.org", "test");
basic_authorization(users(:normal_user).email, "test");
# FIXME we need to create a changeset first argh
# create a node with random lat/lon
lat = rand(100)-50 + rand
lon = rand(100)-50 + rand