BUGFIX: regression, not handling nil count for recent report
This commit is contained in:
parent
067b08c422
commit
c0686a6dc6
|
@ -3,7 +3,7 @@ class NotificationsController < ApplicationController
|
|||
before_filter :ensure_logged_in
|
||||
|
||||
def index
|
||||
notifications = Notification.recent_report(current_user)
|
||||
notifications = Notification.recent_report(current_user, 10)
|
||||
|
||||
current_user.saw_notification_id(notifications.first.id) if notifications.present?
|
||||
current_user.reload
|
||||
|
|
|
@ -90,7 +90,7 @@ class Notification < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.recent_report(user, count = nil)
|
||||
|
||||
count ||= 10
|
||||
notifications = user.notifications.recent(count).includes(:topic).to_a
|
||||
|
||||
if notifications.present?
|
||||
|
|
Loading…
Reference in New Issue