From cd2a52023b5c8cc7890177878aed9827c864f591 Mon Sep 17 00:00:00 2001 From: raluka Date: Thu, 3 Sep 2015 14:20:11 +0200 Subject: [PATCH] changed comments helper to proper return unread comments available for current_user --- app/helpers/application_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 54d79425..3498aaa2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -280,6 +280,7 @@ module ApplicationHelper end def unread_notifications(user) - Comment.find_since_last_login(user) + available_conferences_ids = Conference.with_roles([:admin, :organizer, :cfp], user).pluck(:id) + Comment.find_since_last_login(user).where(commentable_type: 'Event', commentable_id: Event.where(conference_id: available_conferences_ids)) end end