Requests create a read, rather than unread, notification
This commit is contained in:
parent
6cf8de94a7
commit
cd7e4d6e8f
2 changed files with 9 additions and 3 deletions
|
|
@ -54,7 +54,7 @@ private
|
|||
unless n.actors.include?(actor)
|
||||
n.actors << actor
|
||||
end
|
||||
|
||||
|
||||
n.unread = true
|
||||
n.save!
|
||||
n
|
||||
|
|
@ -68,6 +68,7 @@ private
|
|||
:action => action,
|
||||
:recipient_id => recipient.id)
|
||||
n.actors << actor
|
||||
n.unread = false if target.is_a? Request
|
||||
n.save!
|
||||
n
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe Notification do
|
|||
|
||||
it 'destoys the associated notification_actor' do
|
||||
@note.save
|
||||
lambda{@note.destroy}.should change(NotificationActor, :count).by(-1)
|
||||
lambda{@note.destroy}.should change(NotificationActor, :count).by(-1)
|
||||
end
|
||||
|
||||
describe '.for' do
|
||||
|
|
@ -53,6 +53,11 @@ describe Notification do
|
|||
Notification.notify(@user, @request, @person)
|
||||
end
|
||||
|
||||
it 'creates the notification already read' do
|
||||
n = Notification.notify(@user, @request, @person)
|
||||
n.unread?.should be_false
|
||||
end
|
||||
|
||||
it 'sockets to the recipient' do
|
||||
opts = {:target_id => @request.id,
|
||||
:target_type => "Request",
|
||||
|
|
@ -94,7 +99,7 @@ describe Notification do
|
|||
it "updates the notification with a more people if one already exists" do
|
||||
Notification.where(:recipient_id => @user3.id, :target_type => @sm.class.base_class, :target_id => @sm.id).first.actors.count.should == 2
|
||||
end
|
||||
|
||||
|
||||
it 'handles double comments from the same person without raising' do
|
||||
Postzord::Receiver.new(@user3, :person => @user2.person, :object => @user2.comment("hey", :on => @sm)).receive_object
|
||||
Notification.where(:recipient_id => @user3.id, :target_type => @sm.class.base_class, :target_id => @sm.id).first.actors.count.should == 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue