From e13ae6c7de5447a41230b28e78ff75b568e7f79b Mon Sep 17 00:00:00 2001 From: Nani-LM10 Date: Sun, 28 Dec 2025 14:16:46 +0530 Subject: [PATCH] Added Visual Indicator for Unread Threads --- app/views/messages/_threads.html.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/messages/_threads.html.erb b/app/views/messages/_threads.html.erb index 7900a85a..e7f2ba11 100644 --- a/app/views/messages/_threads.html.erb +++ b/app/views/messages/_threads.html.erb @@ -1,4 +1,5 @@ <% threads = message.threads.to_a.select { |t| (t.messages_count || t.messages.active.count) > 0 } %> +<% unread_thread_ids = Membership.where(room_id: threads.map(&:id), user_id: Current.user.id).unread.pluck(:room_id) %>
<% threads.each do |thread| %> <% # Get users who have posted in the thread, ordered by their first message timestamp %> @@ -22,7 +23,11 @@
<%= pluralize(reply_count, 'reply', 'replies') %> <% if reply_count > 0 %> - Last reply <%= local_datetime_tag thread.last_active_at, style: :relative %> + <% if unread_thread_ids.include?(thread.id) %> + Last reply <%= local_datetime_tag thread.last_active_at, style: :relative %> + <% else %> + Last reply <%= local_datetime_tag thread.last_active_at, style: :relative %> + <% end %> <% end %> <% end %> <% end %>