diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index bbc6a35d4..9bef7a2aa 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -50,8 +50,12 @@ class MessagesController < ApplicationController offset(@reply_pages.offset). to_a - @reply = Message.new(:subject => "RE: #{@message.subject}") - render :action => "show", :layout => false if request.xhr? + @reply = Message.new(:subject => "RE: #{@message.subject}") unless @reply + if request.xhr? + render :action => "show", :layout => false + else + render :action => "show" + end end # Create a new topic @@ -82,9 +86,11 @@ class MessagesController < ApplicationController call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) attachments = Attachment.attach_files(@reply, params[:attachments]) render_attachment_warning_if_needed(@reply) + flash[:notice] = l(:notice_successful_update) + redirect_to board_message_path(@board, @topic, :r => @reply) + else + show end - flash[:notice] = l(:notice_successful_update) - redirect_to board_message_path(@board, @topic, :r => @reply) end # Edit a message diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index b8abf0321..cbb5cb112 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -23,6 +23,7 @@

<%= avatar(@topic.author) %><%= @topic.subject %>

+<%= error_messages_for 'reply' %>

<%= authoring @topic.created_on, @topic.author %>

@@ -81,7 +82,7 @@ <% if !@topic.locked? && authorize_for('messages', 'reply') %>

<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>

-