From 9d8d6b023ce3390f3ccf9808e630505a15ebebe6 Mon Sep 17 00:00:00 2001
From: nfoy No Messages Conversations
+ Your Conversations
+
+<%= link_to 'Start a new conversation', new_pm_path %>
+
+
+Unread Conversations
+<% conversations = current_user.mailbox.conversations %>
- <% conversations = current_user.mailbox.conversations %>
- <% if !conversations.empty? %>
- <%# require 'pp' %>
- <%= conversations.class %>
-
-
- <% conversations.each do |conversation| %>
- <% receipts = conversation.receipts_for current_user %>
- <%# receipts.each do |receipt| %>
- <% message = receipts.last.message %>
- With
- Subject
- Body
-
-
- <% people = conversation.participants %>
- <% people.each do |person| %>
- <% unless person == current_user %>
- <%= truncate(person.user_name, length: 20) %>
- <% end %>
+
+
+ <% conversations.each do |conversation| %>
+ <% receipts = conversation.receipts_for current_user %>
+ <% if conversation.is_unread?(current_user) && receipts.last.message.sender != current_user %>
+ <% message = receipts.last.message %>
+ With
+ Subject
+ Body
+
+
- <%# end %>
+ <% end %>
+
+
+ <% people = conversation.participants %>
+ <% people.each do |person| %>
+ <% unless person == current_user %>
+ <%= truncate(person.user_name, length: 20) %>
<% end %>
-
- <%= truncate(conversation.subject, length: 30) %>
- <%= truncate(message.body, length: 42) %>
- <%= link_to 'View', @pms.find_by(conversation: conversation) %>
- <%= truncate(conversation.subject, length: 30) %>
+ <%= truncate(message.body, length: 42) %>
+ <%= link_to 'View', @pms.find_by(conversation: conversation) %>
+
<% end %>
-
- <% else %>
-
<% end %>
-
-
+
+Read Conversations
+<% conversations = current_user.mailbox.conversations %>
-<%= link_to 'New Pm', new_pm_path %>
+
+
\ No newline at end of file
diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb
index 64dd66e..ca8d9bf 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -4,10 +4,10 @@
<% receps.each do |recep| %>
<% #unless recep == @pm.conversation.last_sender %>
<%= recep.user_name %>
- <%= "and" %>
+ <%= "," %>
<% #end %>
<% end %>
- <%= "the NSA" %>
+ <%= "and the NSA" %>
+
+
+ <% conversations.each do |conversation| %>
+ <% receipts = conversation.receipts_for current_user %>
+ <% if conversation.is_read?(current_user) || receipts.last.message.sender == current_user %>
+ <% message = receipts.last.message %>
+ With
+ Subject
+ Body
+
+
+ <% end %>
+ <% end %>
+
+
+
+ <% people = conversation.participants %>
+ <% people.each do |person| %>
+ <% unless person == current_user %>
+ <%= truncate(person.user_name, length: 20) %>
+ <% end %>
+ <% end %>
+
+ <%= truncate(conversation.subject, length: 30) %>
+ <%= truncate(message.body, length: 42) %>
+ <%= link_to 'View', @pms.find_by(conversation: conversation) %>
+
@@ -22,7 +22,7 @@
________________________________________________
- <%= message.sender.user_name %> + <%= message.sender.user_name %> <%= ":" %> <%= message.body %>
@@ -43,5 +43,5 @@ <% end %> - +<% @pm.conversation.mark_as_read(current_user) %> <%= link_to 'Back', pms_path %> -- cgit v1.2.3-2-g168b