From a1d474111b0929ff7223ddfde62c4b19dd474519 Mon Sep 17 00:00:00 2001 From: Steven Fuchs Date: Fri, 23 Dec 2011 15:35:07 -0500 Subject: [PATCH] controller now only accepts string values for unread. --- app/controllers/notifications_controller.rb | 2 +- spec/controllers/notifications_controller_spec.rb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index c2e0e5a79..28fb48922 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -11,7 +11,7 @@ class NotificationsController < VannaController def update(opts=params) note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first if note - note.update_attributes(:unread => opts[:unread].to_s == "true" ) + note.update_attributes(:unread => opts[:unread] == "true" ) {} else Response.new :status => 404 diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 389cdca26..e404334fa 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -21,8 +21,6 @@ describe NotificationsController do end it 'marks a notification as read if it is told to' do note = Factory(:notification, :recipient => @user) - @controller.update :id => note.id, :unread => false - Notification.first.unread.should == false @controller.update :id => note.id, :unread => "false" Notification.first.unread.should == false end @@ -30,8 +28,6 @@ describe NotificationsController do note = Factory(:notification, :recipient => @user) @controller.update :id => note.id, :unread => "true" Notification.first.unread.should == true - @controller.update :id => note.id, :unread => true - Notification.first.unread.should == true end it 'only lets you read your own notifications' do