Merge pull request #3006 from diasp/3004-fix-notification-dropdown

We need json for the notification dropdown #2998
This commit is contained in:
Maxwell Salzberg 2012-03-14 10:34:24 -07:00
commit 654d2e63b3
2 changed files with 8 additions and 4 deletions

View file

@ -36,10 +36,8 @@ class NotificationsController < ApplicationController
pager.replace(result)
end
if request.format != :json
@notifications.each do |n|
n[:note_html] = render_to_string( :partial => 'notify_popup_item', :locals => { :n => n } )
end
@notifications.each do |n|
n[:note_html] = render_to_string( :partial => 'notify_popup_item', :locals => { :n => n } )
end
@group_days = @notifications.group_by{|note| I18n.l(note.created_at, :format => I18n.t('date.formats.fullmonth_day')) }

View file

@ -70,6 +70,12 @@ describe NotificationsController do
Factory(:notification, :recipient => alice, :target => @post)
end
it 'succeeds for notification dropdown' do
get :index, :format => :json
response.should be_success
response.body.should =~ /note_html/
end
it 'paginates the notifications' do
25.times { Factory(:notification, :recipient => alice, :target => @post) }
get :index