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
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
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
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