notification page now has links for likes
This commit is contained in:
parent
d4d3b1e44c
commit
66c28c4caf
2 changed files with 30 additions and 10 deletions
|
|
@ -22,7 +22,10 @@ module NotificationsHelper
|
|||
else
|
||||
t('notifications.also_commented_deleted')
|
||||
end
|
||||
else #Notifications:StartedSharing, Notifications::Liked, etc.
|
||||
elsif note.instance_of?(Notifications::Liked)
|
||||
post = note.target
|
||||
"#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), status_message_path(post), 'data-ref' => post.id, :class => 'hard_object_link'}".html_safe
|
||||
else #Notifications:StartedSharing, etc.
|
||||
translation(target_type)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,20 +2,37 @@ require 'spec_helper'
|
|||
|
||||
|
||||
describe NotificationsHelper do
|
||||
before do
|
||||
@user = Factory(:user)
|
||||
@person = Factory(:person)
|
||||
@post = Factory(:status_message, :author => @user.person)
|
||||
@person2 = Factory(:person)
|
||||
@notification = Notification.notify(@user, Factory(:like, :author => @person, :post => @post), @person)
|
||||
@notification = Notification.notify(@user, Factory(:like, :author => @person2, :post => @post), @person2)
|
||||
|
||||
end
|
||||
describe '#notification_people_link' do
|
||||
describe 'for a like' do
|
||||
it 'displays #{list of actors}' do
|
||||
@user = Factory(:user)
|
||||
@person = Factory(:person)
|
||||
p = Factory(:status_message, :author => @user.person)
|
||||
person2 = Factory(:person)
|
||||
notification = Notification.notify(@user, Factory(:like, :author => @person, :post => p), @person)
|
||||
notification2 = Notification.notify(@user, Factory(:like, :author => person2, :post => p), person2)
|
||||
|
||||
output = notification_people_link(notification2)
|
||||
output.should include person2.name
|
||||
output = notification_people_link(@notification)
|
||||
output.should include @person2.name
|
||||
output.should include @person.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe '#object_link' do
|
||||
describe 'for a like' do
|
||||
it 'should include a link to the post' do
|
||||
output = object_link(@notification)
|
||||
output.should include status_message_path(@post)
|
||||
end
|
||||
|
||||
it 'includes the boilerplate translation' do
|
||||
output = object_link(@notification)
|
||||
output.should include t("#{@notification.popup_translation_key}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue