0

I have the mailboxer gem and I have avatars displaying. In the message view it works, but in the inbox it is showing 2 avatars for each message. One avatar is from the sender and the other is from recipient (current_user). It should only be showing the avatar from the sender.

I believe it's showing both when a conversation is created.

Does someone know how I can restrict it so that inside the inbox it shows avatar of sender only?

Conversation inbox:

<%= content_tag_for(:li, conversation) do |conversation| %>
    <%= link_to conversation.subject, conversation%> - <%= conversation.updated_at.strftime("%B %-d, %Y %l:%M%P") %>
    | From: <% conversation.participants.each do |participant| %>
     <% if participant != current_user %>
      <%= link_to participant.username, participant %>  
     <% end %>
    <% end %>
    <%= content_tag_for(:li, conversation.receipts_for(current_user)) do |receipt| %>
     <% message = receipt.message %>
    <%= image_tag message.sender.avatar.image_url(:avatar) %>
<% end %>   
        <% if conversation.is_completely_trashed?(current_user)%>
      <%= link_to 'Untrash', [:untrash, conversation], method: :post%>
    <%else%>
      <%= link_to 'Move to trash', [:trash, conversation], method: :post%>

<% end %>
<% end %>
pwz2000
  • 1,385
  • 2
  • 16
  • 50

1 Answers1

0

you can use conversation.originator to get only the sender. docs: http://rubydoc.info/gems/mailboxer/Conversation#originator-instance_method

DerMarcus
  • 189
  • 1
  • 9
  • That still shows duplicate avatar from the sender. The issue is it's showing two avatars no matter what code I have tried to use unfortunately. – pwz2000 Apr 04 '14 at 14:35