diff --git a/app/controllers/message_controller.rb b/app/controllers/message_controller.rb index 395d56028..8aecef98e 100644 --- a/app/controllers/message_controller.rb +++ b/app/controllers/message_controller.rb @@ -34,8 +34,10 @@ class MessageController < ApplicationController def reply message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ]) - title = message.title.sub(/^Re:\s*/, "Re: ") - redirect_to :action => 'new', :user_id => message.from_user_id, :title => title + @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' rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found end diff --git a/app/views/message/new.rhtml b/app/views/message/new.rhtml index d66e7caed..723cb1f10 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]).display_name %> +<% display_name = User.find_by_id(params[:user_id] || @user_id).display_name %> <% title = params[:message] ? params[:message][:title] : params[:title] %>
Subject | -<%= text_field_tag 'message[title]', title, :size => 60 %> | +<%= text_field_tag 'message[title]', title, :size => 60, :value => @title %> |
---|---|---|
Body | -<%= f.text_area :body, :cols => 80 %> | +<%= f.text_area :body, :cols => 80, :value => @body %> |
- | <%= submit_tag 'Send' %> | +<%= submit_tag 'Send', :action => 'new' %> |