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
--- /dev/null
+class NodeTag < ActiveRecord::Base
+ set_table_name 'current_node_tags'
+
+ belongs_to :node, :foreign_key => 'id'
+end
--- /dev/null
+class OldNodeTag < ActiveRecord::Base
+ belongs_to :user
+
+ set_table_name 'node_tags'
+
+
+end
-<% 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] %>
<h2>Send a new message to <%= h(display_name) %></h2>
<%= error_messages_for 'message' %>
-<% form_for :message, :url => {:user_id => params[:user_id] || @user_id, :action => "new" } do |f| %>
+<% form_for :message do |f| %>
<table>
<tr valign="top">
<th>Subject</th>
- <td><%= text_field_tag 'message[title]', title, :size => 60, :value => @title %></td>
+ <td><%= text_field_tag 'message[title]', title, :size => 60 %></td>
</tr>
<tr valign="top">
<th>Body</th>
- <td><%= f.text_area :body, :cols => 80, :value => @body %></td>
+ <td><%= f.text_area :body, :cols => 80 %></td>
</tr>
<tr>
<th></th>
- <td><%= submit_tag 'Send', :action => 'new' %></td>
+ <td><%= submit_tag 'Send' %></td>
</tr>
</table>
<% end %>
<% 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.
-<b>You will need to do this if you want to use the online editor and it is encouraged</b> (<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">find out why</a>).
-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. <b>You will need to do this if you want to use the online editor</b> (<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">find out why</a>). This action cannot be reversed.
<br /><br />
- <%= button_to "Make all my edits public", :action => :go_public %>
+ <%= button_to "Make all my edits public, forever", :action => :go_public %>
<% end %>
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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