From: Gabriel Ebner Date: Sat, 3 May 2008 14:11:23 +0000 (+0000) Subject: split_node_tags: Merge changes from main branch. X-Git-Tag: live~7609^2~388 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/7eb181999d3357bf210ceb24e18c913bf3ef6ba3?hp=98d935f663d64e5babbdc73fb37d85e59ba38128 split_node_tags: Merge changes from main branch. --- diff --git a/app/controllers/message_controller.rb b/app/controllers/message_controller.rb index 8aecef98e..395d56028 100644 --- a/app/controllers/message_controller.rb +++ b/app/controllers/message_controller.rb @@ -34,10 +34,8 @@ class MessageController < ApplicationController def reply message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ]) - @body = "\n\nOn #{message.sent_on} #{message.sender.display_name} wrote:\n #{message.body}" - @title = "Re: #{message.title}" - @user_id = message.from_user_id - render :action => 'new' + title = message.title.sub(/^Re:\s*/, "Re: ") + redirect_to :action => 'new', :user_id => message.from_user_id, :title => title rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found end diff --git a/app/models/node_tag.rb b/app/models/node_tag.rb new file mode 100644 index 000000000..9795ff493 --- /dev/null +++ b/app/models/node_tag.rb @@ -0,0 +1,5 @@ +class NodeTag < ActiveRecord::Base + set_table_name 'current_node_tags' + + belongs_to :node, :foreign_key => 'id' +end diff --git a/app/models/old_node_tag.rb b/app/models/old_node_tag.rb new file mode 100644 index 000000000..26a6c92b4 --- /dev/null +++ b/app/models/old_node_tag.rb @@ -0,0 +1,7 @@ +class OldNodeTag < ActiveRecord::Base + belongs_to :user + + set_table_name 'node_tags' + + +end diff --git a/app/views/message/new.rhtml b/app/views/message/new.rhtml index 723cb1f10..d66e7caed 100644 --- a/app/views/message/new.rhtml +++ b/app/views/message/new.rhtml @@ -1,4 +1,4 @@ -<% display_name = User.find_by_id(params[:user_id] || @user_id).display_name %> +<% display_name = User.find_by_id(params[:user_id]).display_name %> <% title = params[:message] ? params[:message][:title] : params[:title] %>

Send a new message to <%= h(display_name) %>

@@ -10,19 +10,19 @@ <%= error_messages_for 'message' %> -<% form_for :message, :url => {:user_id => params[:user_id] || @user_id, :action => "new" } do |f| %> +<% form_for :message do |f| %> - + - + - +
Subject<%= text_field_tag 'message[title]', title, :size => 60, :value => @title %><%= text_field_tag 'message[title]', title, :size => 60 %>
Body<%= f.text_area :body, :cols => 80, :value => @body %><%= f.text_area :body, :cols => 80 %>
<%= submit_tag 'Send', :action => 'new' %><%= submit_tag 'Send' %>
<% end %> diff --git a/app/views/user/account.rhtml b/app/views/user/account.rhtml index d8afa4999..76b4fbb34 100644 --- a/app/views/user/account.rhtml +++ b/app/views/user/account.rhtml @@ -26,9 +26,7 @@ <% if @user.data_public? %> All your edits are public. <% else %> -Currently your edits are anonymous and people can't send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. -You will need to do this if you want to use the online editor and it is encouraged (find out why). -This action cannot be reversed and all new users are now public by default. + Currently your edits are anonymous and people can't send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. You will need to do this if you want to use the online editor (find out why). This action cannot be reversed.

- <%= button_to "Make all my edits public", :action => :go_public %> + <%= button_to "Make all my edits public, forever", :action => :go_public %> <% end %> diff --git a/db/migrate/012_create_node_tags.rb b/db/migrate/012_create_node_tags.rb new file mode 100644 index 000000000..316602d69 --- /dev/null +++ b/db/migrate/012_create_node_tags.rb @@ -0,0 +1,18 @@ +class CreateNodeTags < ActiveRecord::Migration + def self.up + create_table "current_node_tags", myisam_table do |t| + t.column "id", :bigint, :limit => 64, :null => false + t.column "sequence_id", :bigint, :limit => 11, :null => false + t.column "k", :string, :default => "", :null => false + t.column "v", :string, :default => "", :null => false + end + + add_primary_key "current_node_tags", ["id", "sequence_id"] + + execute "CREATE FULLTEXT INDEX `current_node_tags_v_idx` ON `current_node_tags` (`v`)" + end + + def self.down + drop_table :current_node_tags + end +end diff --git a/db/migrate/013_create_old_node_tags.rb b/db/migrate/013_create_old_node_tags.rb new file mode 100644 index 000000000..aeb5abd4c --- /dev/null +++ b/db/migrate/013_create_old_node_tags.rb @@ -0,0 +1,17 @@ +class CreateOldNodeTags < ActiveRecord::Migration + def self.up + create_table "node_tags", myisam_table do |t| + t.column "id", :bigint, :limit => 64, :default => 0, :null => false + t.column "version", :bigint, :limit => 20, :null => false + t.column "sequence_id", :bigint, :limit => 11, :null => false + t.column "k", :string, :null => false + t.column "v", :string, :null => false + end + + add_primary_key "node_tags", ["id", "version", "sequence_id"] + end + + def self.down + drop_table :node_tags + end +end diff --git a/db/migrate/014_populate_node_tags_and_remove.rb b/db/migrate/014_populate_node_tags_and_remove.rb new file mode 100644 index 000000000..7583c6618 --- /dev/null +++ b/db/migrate/014_populate_node_tags_and_remove.rb @@ -0,0 +1,13 @@ +class PopulateNodeTagsAndRemove < ActiveRecord::Migration + def self.up + #rake import + #commented out to stop people from breaking their db +# remove_column :nodes, :tags +# remove_column :current_nodes, :tags + end + + def self.down +# add_column :nodes, "tags", :text, :default => "", :null => false +# add_column :current_nodes, "tags", :text, :default => "", :null => false + end +end diff --git a/db/migrate/015_create_temp_old_nodes.rb b/db/migrate/015_create_temp_old_nodes.rb new file mode 100644 index 000000000..60edb8406 --- /dev/null +++ b/db/migrate/015_create_temp_old_nodes.rb @@ -0,0 +1,24 @@ +class CreateTempOldNodes < ActiveRecord::Migration + def self.up + create_table "temp_nodes", myisam_table do |t| + t.column "id", :bigint, :limit => 64, :null => false + t.column "version", :bigint, :limit => 20, :null => false + t.column "latitude", :double, :null => false + t.column "longitude", :double, :null => false + t.column "user_id", :bigint, :limit => 20, :null => false + t.column "visible", :boolean, :null => false + t.column "timestamp", :datetime, :null => false + t.column "tile", :integer, :null => false + end + + add_primary_key "temp_nodes", ["id", "version"] + add_index "temp_nodes", ["timestamp"], :name => "temp_nodes_timestamp_idx" + add_index "temp_nodes", ["tile"], :name => "temp_nodes_tile_idx" + + change_column "temp_nodes", "version", :bigint, :limit => 20, :null => false, :options => "AUTO_INCREMENT" + end + + def self.down + drop_table :temp_nodes + end +end