Guest User

Untitled

a guest
Nov 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. module Shared::ConversationsHelper
  2.  
  3. def private_conv_seen_status(conversation)
  4. # if the latest message of a conversation is not created by a current_user
  5. # and it is unseen, return an unseen-conv value
  6. not_created_by_user = conversation.messages.last.user_id != current_user.id
  7. unseen = conversation.messages.last.seen == false
  8. not_created_by_user && unseen ? 'unseen-conv' : ''
  9. end
  10. end
Add Comment
Please, Sign In to add comment