Merge remote-tracking branch 'upstream/pull/1863'
This commit is contained in:
commit
9e50c3851c
9 changed files with 50 additions and 54 deletions
|
@ -6,8 +6,8 @@ class MessagesController < ApplicationController
|
|||
before_action :require_user
|
||||
before_action :lookup_user, :only => [:new]
|
||||
before_action :check_database_readable
|
||||
before_action :check_database_writable, :only => [:new, :reply, :mark]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :read]
|
||||
before_action :check_database_writable, :only => [:new, :reply, :mark, :destroy]
|
||||
before_action :allow_thirdparty_images, :only => [:new, :show]
|
||||
|
||||
# Allow the user to write a new message to another user. This action also
|
||||
# deals with the sending of that message to the other user when the user
|
||||
|
@ -61,7 +61,7 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
|
||||
# Show a message
|
||||
def read
|
||||
def show
|
||||
@title = t ".title"
|
||||
@message = Message.find(params[:message_id])
|
||||
|
||||
|
@ -115,13 +115,13 @@ class MessagesController < ApplicationController
|
|||
render :action => "no_such_message", :status => :not_found
|
||||
end
|
||||
|
||||
# Delete the message.
|
||||
def delete
|
||||
# Destroy the message.
|
||||
def destroy
|
||||
@message = Message.where("to_user_id = ? OR from_user_id = ?", current_user.id, current_user.id).find(params[:message_id])
|
||||
@message.from_user_visible = false if @message.sender == current_user
|
||||
@message.to_user_visible = false if @message.recipient == current_user
|
||||
if @message.save && !request.xhr?
|
||||
flash[:notice] = t ".deleted"
|
||||
flash[:notice] = t ".destroyed"
|
||||
|
||||
if params[:referer]
|
||||
redirect_to params[:referer]
|
||||
|
|
|
@ -69,7 +69,7 @@ class Notifier < ActionMailer::Base
|
|||
@from_user = message.sender.display_name
|
||||
@text = message.body
|
||||
@title = message.title
|
||||
@readurl = read_message_url(message)
|
||||
@readurl = message_url(message)
|
||||
@replyurl = reply_message_url(message)
|
||||
@author = @from_user
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<tr id="inbox-<%= message_summary.id %>" class="inbox-row<%= "-unread" if not message_summary.message_read? %>">
|
||||
<td class="inbox-sender"><%= link_to h(message_summary.sender.display_name), user_path(message_summary.sender) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(message_summary.title), read_message_path(message_summary) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(message_summary.title), message_path(message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-mark-unread"><%= button_to t('.unread_button'), mark_message_path(message_summary, :mark => 'unread'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-read"><%= button_to t('.read_button'), mark_message_path(message_summary, :mark => 'read'), { :remote => true } %></td>
|
||||
<td class="inbox-delete"><%= button_to t('.delete_button'), delete_message_path(message_summary, :referer => request.fullpath), { :remote => true } %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(message_summary, :referer => request.fullpath), { :remote => true } %></td>
|
||||
</tr>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<tr class="inbox-row">
|
||||
<td class="inbox-sender"><%= link_to h(sent_message_summary.recipient.display_name), user_path(sent_message_summary.recipient) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(sent_message_summary.title), read_message_path(sent_message_summary) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(sent_message_summary.title), message_path(sent_message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-delete"><%= button_to t('.delete_button'), delete_message_path(sent_message_summary, :referer => request.fullpath) %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), destroy_message_path(sent_message_summary, :referer => request.fullpath) %></td>
|
||||
</tr>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class='message-buttons buttons'>
|
||||
<%= button_to t('.reply_button'), reply_message_path(@message), :class => 'reply-button' %>
|
||||
<%= button_to t('.unread_button'), mark_message_path(@message, :mark => 'unread'), :class => 'mark-unread-button' %>
|
||||
<%= button_to t('.delete_button'), delete_message_path(@message), :class => 'delete-button' %>
|
||||
<%= button_to t('.destroy_button'), destroy_message_path(@message), :class => 'destroy-button' %>
|
||||
|
||||
<% else %>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue