diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index 787e7f0ab..be45ed46e 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -1,37 +1,38 @@
module NotificationsHelper
- def object_link(note)
+ def object_link(note, actors)
target_type = note.popup_translation_key
+ actors_count = note.actors.count
if note.instance_of?(Notifications::Mentioned)
post = Mention.find(note.target_id).post
if post
- translation(target_type, :post_link => link_to(t('notifications.post'), object_path(post)).html_safe)
+ translation(target_type, :actors => actors, :count => actors_count, :post_link => link_to(t('notifications.post'), object_path(post)).html_safe)
else
- t('notifications.mentioned_deleted')
+ t('notifications.mentioned_deleted', :actors => actors, :count => actors_count).html_safe
end
elsif note.instance_of?(Notifications::CommentOnPost)
post = Post.where(:id => note.target_id).first
if post
- translation(target_type, :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
+ translation(target_type, :actors => actors, :count => actors_count, :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
else
- t('notifications.also_commented_deleted')
+ t('notifications.also_commented_deleted', :actors => actors, :count => actors_count).html_safe
end
elsif note.instance_of?(Notifications::AlsoCommented)
post = Post.where(:id => note.target_id).first
if post
- translation(target_type, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
+ translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
else
- t('notifications.also_commented_deleted')
+ t('notifications.also_commented_deleted', :actors => actors, :count => actors_count).html_safe
end
elsif note.instance_of?(Notifications::Liked)
post = note.target
post = post.post if post.is_a? Like
if post
- translation(target_type, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
+ translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
else
- t('notifications.liked_post_deleted')
+ t('notifications.liked_post_deleted', :actors => actors, :count => actors_count).html_safe
end
else #Notifications:StartedSharing, etc.
- translation(target_type)
+ translation(target_type, :actors => actors, :count => actors_count)
end
end
@@ -62,12 +63,16 @@ module NotificationsHelper
others_sentence = " #{t('notifications.index.and')} " + others_sentence
end
message = "#{first}, #{second}, #{third},"
- message += " #{t('notifications.index.and_others', :number =>(number_of_actors - 3))}"
+ message += " #{t('notifications.index.and_others', :count =>(number_of_actors - 3))}"
message += " #{others_sentence} "
end
message.html_safe
end
+ def notification_message_for(note)
+ object_link(note, notification_people_link(note))
+ end
+
def peoples_names(note)
note.actors.map{|p| p.name}.join(", ")
end
diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml
index 85eb9a170..a77472fce 100644
--- a/app/views/notifications/index.html.haml
+++ b/app/views/notifications/index.html.haml
@@ -23,8 +23,7 @@
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => note.target, :hang => 'left'
%span.from
- = notification_people_link(note)
- = object_link(note)
+ = notification_message_for(note)
%br
%time= timeago(note.created_at)
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index f1472ad57..a6655b945 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -289,21 +289,70 @@ en:
other: "%{count} dislikes"
notifications:
- started_sharing: "started sharing with you."
- new_request: "offered to share with you."
- private_message: "sent you a message."
- comment_on_post: "commented on your %{post_link}."
- also_commented: "also commented on %{post_author}'s %{post_link}."
- mentioned: "has mentioned you in a %{post_link}."
- liked: "has just liked your %{post_link}."
+ started_sharing:
+ zero: "%{actors} started sharing with you."
+ one: "%{actors} started sharing with you."
+ few: "%{actors} started sharing with you."
+ many: "%{actors} started sharing with you."
+ other: "%{actors} started sharing with you."
+ private_message:
+ zero: "%{actors} sent you a message."
+ one: "%{actors} sent you a message."
+ few: "%{actors} sent you a message."
+ many: "%{actors} sent you a message."
+ other: "%{actors} sent you a message."
+ comment_on_post:
+ zero: "%{actors} commented on your %{post_link}."
+ one: "%{actors} commented on your %{post_link}."
+ few: "%{actors} commented on your %{post_link}."
+ many: "%{actors} commented on your %{post_link}."
+ other: "%{actors} commented on your %{post_link}."
+ also_commented:
+ zero: "%{actors} also commented on %{post_author}'s %{post_link}."
+ one: "%{actors} also commented on %{post_author}'s %{post_link}."
+ few: "%{actors} also commented on %{post_author}'s %{post_link}."
+ many: "%{actors} also commented on %{post_author}'s %{post_link}."
+ other: "%{actors} also commented on %{post_author}'s %{post_link}."
+ mentioned:
+ zero: "%{actors} has mentioned you in a %{post_link}."
+ one: "%{actors} has mentioned you in a %{post_link}."
+ few: "%{actors} has mentioned you in a %{post_link}."
+ many: "%{actors} has mentioned you in a %{post_link}."
+ other: "%{actors} has mentioned you in a %{post_link}."
+ liked:
+ zero: "%{actors} has just liked your %{post_link}."
+ one: "%{actors} has just liked your %{post_link}."
+ few: "%{actors} has just liked your %{post_link}."
+ many: "%{actors} has just liked your %{post_link}."
+ other: "%{actors} has just liked your %{post_link}."
post: "post"
- also_commented_deleted: "commented on a deleted post."
- liked_post_deleted: "liked your deleted post."
- mentioned_deleted: "mentioned you in a deleted post."
+ also_commented_deleted:
+ zero: "%{actors} commented on a deleted post."
+ one: "%{actors} commented on a deleted post."
+ few: "%{actors} commented on a deleted post."
+ many: "%{actors} commented on a deleted post."
+ other: "%{actors} commented on a deleted post."
+ liked_post_deleted:
+ zero: "%{actors} liked your deleted post."
+ one: "%{actors} liked your deleted post."
+ few: "%{actors} liked your deleted post."
+ many: "%{actors} liked your deleted post."
+ other: "%{actors} liked your deleted post."
+ mentioned_deleted:
+ zero: "%{actors} mentioned you in a deleted post."
+ one: "%{actors} mentioned you in a deleted post."
+ few: "%{actors} mentioned you in a deleted post."
+ many: "%{actors} mentioned you in a deleted post."
+ other: "%{actors} mentioned you in a deleted post."
index:
notifications: "Notifications"
mark_all_as_read: "Mark All as Read"
- and_others: "and %{number} others"
+ and_others:
+ zero: "and nobody else"
+ one: "and one more"
+ few: "and %{count} others"
+ many: "and %{count} others"
+ other: "and %{count} others"
and: 'and'
helper:
new_notifications:
diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb
index b03dec3fa..646384aae 100644
--- a/spec/helpers/notifications_helper_spec.rb
+++ b/spec/helpers/notifications_helper_spec.rb
@@ -67,25 +67,26 @@ describe NotificationsHelper do
describe '#object_link' do
describe 'for a like' do
it 'should include a link to the post' do
- output = object_link(@notification)
+ output = object_link(@notification, notification_people_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}",
+ output = object_link(@notification, notification_people_link(@notification))
+ output.should include t("#{@notification.popup_translation_key}.one",
+ :actors => notification_people_link(@notification),
:post_link => "#{t('notifications.post')}")
end
context 'when post is deleted' do
it 'works' do
@post.destroy
- expect{ object_link(@notification)}.should_not raise_error
+ expect{ object_link(@notification, notification_people_link(@notification))}.should_not raise_error
end
it 'displays that the post was deleted' do
@post.destroy
- object_link(@notification).should == t('notifications.liked_post_deleted')
+ object_link(@notification, notification_people_link(@notification)).should == t('notifications.liked_post_deleted.one', :actors => notification_people_link(@notification))
end
end
end