remove object_id for notifications thx sarahmei for pointing out my evil ways
This commit is contained in:
parent
ed0e739ac3
commit
e0883fb176
3 changed files with 7 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ module NotificationsHelper
|
|||
when 'new_request'
|
||||
translation
|
||||
when 'comment_on_post'
|
||||
"#{translation} #{link_to t('notifications.post'), object_path(Comment.first(:id => note.object_id).post)}".html_safe
|
||||
"#{translation} #{link_to t('notifications.post'), object_path(Comment.first(:id => note.target_id).post)}".html_safe
|
||||
else
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
class Notification
|
||||
include MongoMapper::Document
|
||||
|
||||
key :object_id, ObjectId
|
||||
key :target_id, ObjectId
|
||||
key :kind, String
|
||||
key :unread, Boolean, :default => true
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ class Notification
|
|||
|
||||
timestamps!
|
||||
|
||||
attr_accessible :object_id, :kind, :user_id, :person_id, :unread
|
||||
attr_accessible :target_id, :kind, :user_id, :person_id, :unread
|
||||
|
||||
def self.for(user, opts={})
|
||||
self.where(opts.merge!(:user_id => user.id)).order('created_at desc')
|
||||
|
|
@ -23,7 +23,7 @@ class Notification
|
|||
def self.notify(user, object, person)
|
||||
if object.respond_to? :notification_type
|
||||
if kind = object.notification_type(user, person)
|
||||
Notification.create(:object_id => object.id,
|
||||
Notification.create(:target_id => object.id,
|
||||
:kind => kind,
|
||||
:person_id => person.id,
|
||||
:user_id => user.id)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe Notification do
|
|||
@user = make_user
|
||||
@user2 = make_user
|
||||
@aspect = @user.aspects.create(:name => "dudes")
|
||||
@opts = {:object_id => @sm.id, :kind => @sm.class.name, :person_id => @person.id, :user_id => @user.id}
|
||||
@opts = {:target_id => @sm.id, :kind => @sm.class.name, :person_id => @person.id, :user_id => @user.id}
|
||||
@note = Notification.new(@opts)
|
||||
end
|
||||
|
||||
|
|
@ -20,8 +20,8 @@ describe Notification do
|
|||
@note.kind.should == StatusMessage.name
|
||||
end
|
||||
|
||||
it 'contains a object_id' do
|
||||
@note.object_id.should == @sm.id
|
||||
it 'contains a target_id' do
|
||||
@note.target_id.should == @sm.id
|
||||
end
|
||||
|
||||
it 'contains a person_id' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue