<% if cuser.received_messages.any? %>
<% cuser.received_messages.reverse_each do |message| %>
<% if cuser.new_messages.include?(message) %>
<% else %>
<% end %>
<%= render partial: 'message', locals: { message: message } %>
<% end %>
<% else %>
You have no incoming messages.
<% end %>
<% if cuser.sent_messages.any? %>
<% cuser.sent_messages.reverse_each do |message| %>
<%= render partial: 'message', locals: { message: message } %>
<% end %>
<% else %>
You have no sent messages.
<% end %>