Skip to content

Instantly share code, notes, and snippets.

@tbcooney
Last active April 29, 2020 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbcooney/e7fcf7b24b501b455a423b836ff54e4c to your computer and use it in GitHub Desktop.
Save tbcooney/e7fcf7b24b501b455a423b836ff54e4c to your computer and use it in GitHub Desktop.
group_by_date_messages.rb
@messages.each do |day, messages|
%li.date_divider.w-full.block
.break
%span= "#{day.strftime("%B %d")}"
%ul
- messages.each do |message|
- if !unread_messages && @chatroom_user.last_read_at < message.created_at
- unread_messages = true
.strike
%span Unread Messages
= render partial: 'admin/facilities/chatrooms/chatroom/messages/message',
locals: {message: message, facility: @facility, chatroom: @chatroom}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment