no notifications on retractions
This commit is contained in:
parent
61b2bbbd7d
commit
9555fae33d
4 changed files with 17 additions and 4 deletions
|
|
@ -14,5 +14,10 @@ class Notification
|
|||
|
||||
timestamps!
|
||||
|
||||
attr_accessible :object_id, :kind, :user, :person
|
||||
attr_accessible :object_id, :kind, :user_id, :person_id
|
||||
|
||||
def for(user, opts={})
|
||||
query = opts.merge(:user_id => user)
|
||||
self.all(opts)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ module Diaspora
|
|||
end
|
||||
|
||||
def receive_object(object,person)
|
||||
unless object.is_a? Retraction
|
||||
Notification.create(:object_id => object.id, :kind => object.class.name, :person_id => person.id, :user_id => self.id)
|
||||
end
|
||||
if object.is_a?(Request)
|
||||
receive_request object, person
|
||||
elsif object.is_a?(Profile)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ describe Notification do
|
|||
@person = Factory(:person)
|
||||
@user = make_user
|
||||
@note = Notification.new(:object_id => @sm.id, :kind => @sm.class.name, :person => @person, :user => @user)
|
||||
puts @note.inspect
|
||||
end
|
||||
|
||||
it 'contains a type' do
|
||||
|
|
@ -25,5 +24,9 @@ describe Notification do
|
|||
it 'contains a person_id' do
|
||||
@note.person.id == @person.id
|
||||
end
|
||||
|
||||
describe '.for' do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -60,10 +60,12 @@ describe User do
|
|||
|
||||
describe '#receive_object' do
|
||||
it 'adds a notification for an object' do
|
||||
Notification.should_receive(:new)
|
||||
Notification.should_receive(:create)
|
||||
user = make_user
|
||||
user.receive_object(Factory(:status_message), Factory(:person))
|
||||
sm = Factory.create(:status_message)
|
||||
person = Factory.create(:person)
|
||||
user.should_receive(:receive_post).and_return(true)
|
||||
user.receive_object(sm, person)
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue