FEATURE: Mark All as Read button for Notifications page

Added a Mark All as Read button to the top/bottom of the notifications user page
https://meta.discourse.org/t/possibility-to-selectively-or-completely-mark-notifications-as-read/20227

Remove notifications property (no longer used)
This commit is contained in:
cpradio
2014-10-13 06:26:30 -04:00
parent d3b268cd2c
commit 8f390c979b
11 changed files with 87 additions and 1 deletions

View File

@ -15,18 +15,37 @@ describe NotificationsController do
response.should be_success
end
it 'should succeed for history' do
xhr :get, :reset_new
response.should be_success
end
it 'should mark notifications as viewed' do
notification = Fabricate(:notification, user: user)
user.reload.unread_notifications.should == 1
user.reload.total_unread_notifications.should == 1
xhr :get, :recent
user.reload.unread_notifications.should == 0
user.reload.total_unread_notifications.should == 1
end
it 'should not mark notifications as viewed if silent param is present' do
notification = Fabricate(:notification, user: user)
user.reload.unread_notifications.should == 1
user.reload.total_unread_notifications.should == 1
xhr :get, :recent, silent: true
user.reload.unread_notifications.should == 1
user.reload.total_unread_notifications.should == 1
end
it "updates the `read` status" do
notification = Fabricate(:notification, user: user)
user.reload.unread_notifications.should == 1
user.reload.total_unread_notifications.should == 1
xhr :put, :reset_new
user.reload
user.reload.unread_notifications.should == 0
user.reload.total_unread_notifications.should == 0
end
end