Make the message reply link prefill the title with "Re: original title".
Closes #634.
This commit is contained in:
parent
2eec60b575
commit
b416597507
6 changed files with 17 additions and 7 deletions
|
@ -20,6 +20,14 @@ class MessageController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
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
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :nothing => true, :status => :not_found
|
||||
end
|
||||
|
||||
def read
|
||||
@title = 'read message'
|
||||
@message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ])
|
||||
|
|
|
@ -59,8 +59,8 @@ class Notifier < ActionMailer::Base
|
|||
:controller => "message", :action => "read",
|
||||
:message_id => message.id),
|
||||
:replyurl => url_for(:host => SERVER_URL,
|
||||
:controller => "message", :action => "new",
|
||||
:user_id => message.from_user_id)
|
||||
:controller => "message", :action => "reply",
|
||||
:message_id => message.id)
|
||||
end
|
||||
|
||||
def friend_notification(friend)
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
<% else %>
|
||||
<td><%= button_to 'Mark as read', :controller => 'message', :action => 'mark', :message_id => message_summary.id, :mark => 'read' %></td>
|
||||
<% end %>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'new', :user_id => message_summary.from_user_id %></td>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'reply', :message_id => message_summary.id %></td>
|
||||
</tr>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<% display_name = (User.find_by_id(params[: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 <%= display_name %></h2>
|
||||
|
||||
|
@ -13,7 +14,7 @@
|
|||
<table>
|
||||
<tr valign="top">
|
||||
<th>Subject</th>
|
||||
<td><%= f.text_field :title, :size => 60 %></td>
|
||||
<td><%= text_field_tag 'message[title]', title, :size => 60 %></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>Body</th>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'new', :user_id => @message.from_user_id %></td>
|
||||
<td><%= button_to 'Reply', :controller => 'message', :action => 'reply', :message_id => @message.id %></td>
|
||||
<td><%= button_to 'Mark as unread', :controller => 'message', :action => 'mark', :message_id => @message.id, :mark => 'unread' %></td>
|
||||
<td><%= link_to 'Back to inbox', :controller => 'message', :action => 'inbox', :display_name => @user.display_name %></td>
|
||||
</tr>
|
||||
|
|
|
@ -122,7 +122,8 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect '/message/new/:user_id', :controller => 'message', :action => 'new'
|
||||
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
|
||||
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
|
||||
|
||||
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
|
||||
|
||||
# fall through
|
||||
map.connect ':controller/:id/:action'
|
||||
map.connect ':controller/:action'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue