From 350da4ac3ec6cb3df5a98f8d256eb3b58399eac4 Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 29 Jun 2014 00:34:02 +0200 Subject: [PATCH] Fix: Sub forum last activity indication --- app/views/forums/index.html.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 0e816fb..683a3ab 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -15,8 +15,13 @@
<%= link_to f.name, f, id: "forum-#{f.id}"%>
- <% if trd = f.threads.last %> - <%= trd.author.name %> <%= link_to "posted", forumthread_path(trd) %> . + <% if last_thread = f.threads.last %> + <% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %> + <% if last_reply && last_reply.created_at > last_thread.created_at %> + <%= last_reply.author.name %> <%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %> . + <% else %> + <%= last_thread.author.name %> <%= link_to "posted", forumthread_path(last_thread) %> . + <% end %> <% else %> No posts yet. <% end %>