added post author to the subject of the also commented email as well as the notification

This commit is contained in:
zhitomirskiyi 2011-02-23 13:03:11 -08:00
parent 97e00f9ee3
commit e106ec6a79
2 changed files with 14 additions and 11 deletions

View file

@ -1,37 +1,40 @@
module NotificationsHelper
def object_link(note)
target_type = note.action
translation = t("notifications.#{target_type}")
case target_type
when 'mentioned'
post = Mention.find(note.target_id).post
if post
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
"#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe
else
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
end
when 'request_accepted'
translation
translation(target_type)
when 'new_request'
translation
translation(target_type)
when 'comment_on_post'
post = Post.where(:id => note.target_id).first
if post
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
"#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe
else
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
end
when 'also_commented'
post = Post.where(:id => note.target_id).first
if post
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
"#{translation(target_type, post.person.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe
else
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
"#{translation(target_type, post.person.name)} #{t('notifications.deleted')} #{t('notifications.post')}"
end
else
end
end
def translation(target_type, post_author = nil)
t("notifications.#{target_type}", :post_author => post_author)
end
def new_notification_text(count)
if count > 0
t('new_notifications', :count => count)

View file

@ -223,7 +223,7 @@ en:
request_accepted: "accepted your share request."
new_request: "offered to share with you."
comment_on_post: "commented on your"
also_commented: "also commented on your contact's"
also_commented: "also commented on %{post_author}'s"
mentioned: "has mentioned you in their"
post: "post"
deleted: "deleted"
@ -479,7 +479,7 @@ en:
commented: "has commented on your post:"
sign_in: "Sign in to view it."
also_commented:
subject: "%{name} has also commented on your contact's post."
subject: "%{name} has also commented on your %{post_author}'s post."
commented: "has also commented on %{post_author}'s post:"
sign_in: "Sign in to view it."
mentioned: