From de8a60a3e371e6289643dfb578b75458b856b07d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 10 Aug 2023 20:38:49 +0300 Subject: [PATCH] Check recipient condition separately for message header/footer --- app/views/messages/show.html.erb | 41 +++++++++++++------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index ef8f472fc..0acfa88e1 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -2,36 +2,29 @@

<%= @message.title %>

<% end %> -<% if current_user == @message.recipient %> -
+
+ <% if current_user == @message.recipient %> <%= user_thumbnail_tiny @message.sender %> - <%= link_to @message.sender.display_name, user_path(@message.sender) %> - - <%= l @message.sent_on, :format => :friendly %> - -
+ <%= link_to @message.sender.display_name, user_path(@message.sender) %> + <% else %> + <%= user_thumbnail_tiny @message.recipient %> + <%= link_to @message.recipient.display_name, user_path(@message.recipient) %> + <% end %> + + <%= l @message.sent_on, :format => :friendly %> + +
-
<%= @message.body.to_html %>
+
<%= @message.body.to_html %>
-
+
+ <% if current_user == @message.recipient %> <%= link_to t(".reply_button"), message_reply_path(@message), :class => "btn btn-primary" %> <%= link_to t(".unread_button"), message_mark_path(@message, :mark => "unread"), :method => "post", :class => "btn btn-primary" %> <%= link_to t(".destroy_button"), message_path(@message), :method => "delete", :class => "btn btn-danger" %> <%= link_to t(".back"), inbox_messages_path, :class => "btn btn-link" %> -
-<% else %> -
- <%= user_thumbnail_tiny @message.recipient %> - <%= link_to @message.recipient.display_name, user_path(@message.recipient) %> - - <%= l @message.sent_on, :format => :friendly %> - -
- -
<%= @message.body.to_html %>
- -
+ <% else %> <%= link_to t(".destroy_button"), message_path(@message), :method => "delete", :class => "btn btn-danger" %> <%= link_to t(".back"), outbox_messages_path, :class => "btn btn-link" %> -
-<% end %> + <% end %> +
-- 2.39.5