diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index efbbd09e6..7e0af8645 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -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')) } diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index bfc73ac6e..f468e5fc1 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -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